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 static member function
- To: jb at trisignal dot com
- Subject: Re: c++/1841: Incorrect error: invalid use of member '' in static member function
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Fri, 2 Feb 2001 22:24:58 +0000
- Cc: gcc-gnats at gcc dot gnu dot org, normandb at trisignal dot com, gcc-bugs at gcc dot gnu dot org
- References: <20010202201727.25966.qmail@sourceware.cygnus.com>
jb@trisignal.com wrote:-
> The compiler rejects taking the pointer to a class data member in a
> static function. CodeSourcery's Online Test Compilation gives the
> same error. The same code compiles with the Diab MSVC compilers
> with -strict-ansi enabled.
In my experience MSVC compiling something tells you very little about
its correctness, unless you're talking about -ve correlations :-)
> struct X
> {
> static int X::* foo () { return &x; };
>
> int x;
> };
Maybe you could explain what this means? I don't think it has a
meaning. If a member function is static, it applies to the class as a
type, and not any specific instance. So the 'x' of which instance are
you trying to return a pointer to?
Neil.