pointer member constant expression

Perry Smith pedz@easesoftware.net
Fri Feb 24 14:37:00 GMT 2006


I have asked this question before -- maybe to the gcc-help list but  
I'm still unclear.

The problem is this:

struct foo {
     int a;
     int b;
     int c;
};

static const int foo::*j = &foo::c;			// accepted

class dog {
     static const int foo::*k = &foo::c;	// error
};

5.19 (constant expressions) paragraph 2, the last item in the 1998 C+ 
+ spec says " -- a pointer to member constant expression."  That  
appears to be defined as: '&' qualified-id (5.19 paragraph 6).

So is the line in error legal C++ or not?

Thanks,
Perry



More information about the Gcc mailing list