C++ error: cannot convert "unsigned int A::*" to "unsigned int*" in return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux