struct B { int i; };
struct D1 : virtual B {};
struct D2 : B {}; // <-- not virtual
struct DD : D1, D2 {};
Having coded above, still the compiler demands D2
also to be virtual
:
DD d;
d.i = 0; // error: request for member `i' is ambiguous
What I don't understand is, once you have prompted compiler that B
is virtual
with respect to DD
(via D1
) then why it still i
is ambiguous ?
(If my memory serves correct, the older VC++ (in 2006), was capable enough to make out this just with single virtual
inheritance)