S
Shriramana Sharma
Hello. Please see the following code:
struct A { static int i ; } ;
int A::* ip = & A::i ;
I get the following errors with GCC 4.7.3 and Clang 3.2:
GCC: error: cannot convert ‘int*’ to ‘int A::*’ in initialization
Clang: error: cannot initialize a variable of type 'int A::*' with an rvalue of type 'int *'
I thought members of a class are in its scope. Reading §9.4 (class.static) of C++11 doesn't help me any since it doesn't seem to speak about the scope of static members. Even §3.3 (basic.scope) and §3.3.7 (basic.scope.class) doesn't seem to help me.
What am I missing? Please help. Thanks.
struct A { static int i ; } ;
int A::* ip = & A::i ;
I get the following errors with GCC 4.7.3 and Clang 3.2:
GCC: error: cannot convert ‘int*’ to ‘int A::*’ in initialization
Clang: error: cannot initialize a variable of type 'int A::*' with an rvalue of type 'int *'
I thought members of a class are in its scope. Reading §9.4 (class.static) of C++11 doesn't help me any since it doesn't seem to speak about the scope of static members. Even §3.3 (basic.scope) and §3.3.7 (basic.scope.class) doesn't seem to help me.
What am I missing? Please help. Thanks.