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: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Mar 2012 16:42:42 +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 #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-01 16:42:42 UTC ---
yes, the C++ standard is very clear about this:
A pointer to member is only formed when an explicit & is used and its operand
is a qualified-id not enclosed in parentheses. [ Note: that is, the expression
&(qualified-id), where the qualified-id is enclosed in parentheses, does not
form an expression of type âpointer to member.â Neither does qualified-id,
because there is no implicit conversion from a qualified-id for a non-static
member function to the type âpointer to member functionâ as there is from an
lvalue of function type to the type âpointer to functionâ (4.3). Nor is
&unqualified-id a pointer to member, even within the scope of the
unqualified-idâs class. âend note ]