I have the following code:
struct A {
protected:
A() {}
A* a;
};
struct B : A {
protected:
B() { b.a = &b; }
A b;
};
It strangely doesn't compile. The culprit is the b.a = &b;
assignment: both GCC and clang complain that A()
is protected, which shouldn't be a problem because B inherits A. Which dark corner of the standard have I come into?