This code works fine with gcc 3.x and 4.0, but generates odd compile
time errors with VC++ 2003 .NET. Is there something subtle that's wrong
with it, or is it just a compiler bug?
struct A {
static const char c = 'A';
};
struct B : public A {
static const char c = 'B';
typedef A PARENT;
};
struct C : public B {
static const char c = 'C';
typedef B PARENT;
};
main()
{
cout << C::c;
cout << C::PARENT::c;
cout << C::PARENT::PARENT::c;
return 0;
}
For some reason, the compiler is unable to resolve the line of code
that attempts to root back through two typedefs to the base class A. It
tells me that "__ctor is not a member of B".