[Bug c++/52453] compiling error when get address of a virtual function(invalid use of non-static member function)

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 1 16:34:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52453

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-01 16:34:29 UTC ---
GCC 4.2 is no longer supported, but it doesn't matter because your code is
invalid anyway.

To take the address of a member function you must not use parentheses around
the expression:

    pTestfunc pf = &Test::func;



More information about the Gcc-bugs mailing list