Hi.
Visual C++ reports error 2440 for the following code:
struct a_t { int i;};
struct b_t:a_t { int j;};
b_t* pb = 0;
a_t* const * ref_pa = &pb; // Error 2440 reported for no reason at all.
I cannot see why this should give an error, the base class pointer reference is declared as referring to constant pointer memory. Thus, the contents cannot be changed.
It is a greatly deplorable since it hinders a function call of this kind:
void f( a_t* const * pointer_list) {}
b_t* list[10];
// Call of f with the b_t pointer list:
f(list); // Gives compiler error 2440...
This forces unnatural rewriting of the code. In the above case one might have a host of
other subclasses of a_t and one needs to write a function declaration for each single type.