This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c++/1841: Incorrect error: invalid use of member '' in static member function


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]