C++ error: cannot convert "unsigned int A::*" to "unsigned int*" in return
Erik
sigra@home.se
Sat Oct 28 17:19:00 GMT 2006
The following code does not work:
1: struct A {unsigned int j;};
2: struct B : public A {
3: unsigned int j() const throw () {return A::j;}
4: unsigned int * f() {return &A::j;}
5: };
g++:
In member function "unsigned int* B::f()":
cc_operators.cc:4: fel: cannot convert "unsigned int A::*" to "unsigned
int*" in return
If I change it to &(A::j) it works, but that should not be needed since
operator:: has highest precedence according to the book, right?
More information about the Gcc-help
mailing list