This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52453] compiling error when get address of a virtual function(invalid use of non-static member function)
- From: "wildpointercs at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Mar 2012 16:40:07 +0000
- Subject: [Bug c++/52453] compiling error when get address of a virtual function(invalid use of non-static member function)
- Auto-submitted: auto-generated
- References: <bug-52453-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52453
--- Comment #2 from Allen Wu <wildpointercs at gmail dot com> 2012-03-01 16:40:07 UTC ---
Thank you for your response.
But I cannot see any difference between &Test::func and &(Test::func). Does
C++ standard specify &(Test::func) is illegal?
Thanks in advance.
Allen
2012/3/2 redi at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> 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;
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>