c++/1841: Incorrect error: invalid use of member '' in staticmember function
Jean-Bernard Delva
jb@trisignal.com
Sun Apr 1 00:00:00 GMT 2001
The following reply was made to PR c++/1841; it has been noted by GNATS.
From: Jean-Bernard Delva <jb@trisignal.com>
To: Alexandre Oliva <aoliva@redhat.com>,
'Neil Booth' <neil@daikokuya.demon.co.uk>
Cc: Martin Sebor <sebor@roguewave.com>,
Jean-Bernard Delva <JeanBernard.Delva@trisignal.com>,
gcc-gnats@gcc.gnu.org,
Normand Barriere <Normand.Barriere@trisignal.com>,
gcc-bugs@gcc.gnu.org
Subject: Re: c++/1841: Incorrect error: invalid use of member '' in staticmember function
Date: Sat, 03 Feb 2001 12:46:42 -0500
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?
More information about the Gcc-prs
mailing list