This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/1841: Incorrect error: invalid use of member '' in staticmember function
- To: Alexandre Oliva <aoliva at redhat dot com>,'Neil Booth' <neil at daikokuya dot demon dot co dot uk>
- Subject: Re: c++/1841: Incorrect error: invalid use of member '' in staticmember function
- From: Jean-Bernard Delva <jb at trisignal dot com>
- Date: Sat, 03 Feb 2001 12:46:42 -0500
- CC: Martin Sebor <sebor at roguewave dot com>,Jean-Bernard Delva <JeanBernard dot Delva at trisignal dot com>,gcc-gnats at gcc dot gnu dot org,Normand Barriere <Normand dot Barriere at trisignal dot com>,gcc-bugs at gcc dot gnu dot org
On 03-Feb-01, Alexandre Oliva wrote:
> On Feb 3, 2001, "'Neil Booth'" <neil@daikokuya.demon.co.uk> wrote:
>
>> Martin Sebor wrote:-
>
>>>>>> struct X { static int X::* foo () { return &x; }; int x; };
>
>>> 5.3.1, p2: "The result of the unary & operator is a pointer to its
>>> operand. The operand shall be an lvalue or a qualified-id. [...]
>>> For a qualified-id, [...] If the member is a nonstatic member of
>>> class C of type T, the type of the result is ``pointer to member of
>>> class C of type T.'
>
>> You've confused me now. According to the last few words of what you
>> quoted, I read that the type of "&x" is int X::*. That is the type
>> being returned in the function prototype. So what's wrong?
>
> x is neither an lvalue nor a qualified-id. To get a
> pointer-to-member, the C++ Standard requires &X::x. Just &x won't do.
I see.
It works. Thank you.
I'm so sorry for flagging this as a bug. I should have used the mailing lists
instead. How can I remove my bug report?