I came across the diamond problem and found different solutions for different cases with a single diamond. However I couldn\'t find a solution for \'chained\' diamonds.
It is. The error is due to a bug in your compiler.
s->kid1::val
does not mean "val
from the kid1
subobject". It's just a name qualified by the type (not the subobject) that contains it.
I don't know why country1::kid1
is even accepted at all, but apparently it's a typedef for ::kid1
. Two data members in world
both have the qualified name ::kid1::val
.
What you want is:
world* w = new world;
country1* const c1 = world;
c1->kid1::val = 1;