C ++ 11 (N3485) 10.1.4 [class.mi] says:
For each separate occurrence of a non-virtual base class in the class lattice of the most derived class, the most derived object must contain the corresponding separate subobject of the base class of this type.
For each individual base class that is specified as virtual, the most derived class must contain one base class object of this type.
Consider the following C ++ 11 code:
struct B {}; struct BV : virtual B {}; struct BN : B {}; struct C1 : BV, BN {}; struct C2 : BV, BN {}; struct D : C1, C2 {};
First, for clarity, how many vertices does a class D lattice have?
Secondly, how many different subobjects of type B usually require that a derived object of type D itself have?
update:
Which of the following class lattice?
(one)
BBBB ^ ^ ^ ^ | | | | BV BN BV BN ^ ^ ^ ^ | | | | \ / \ / C1 C2 \ / \ / - D -
(2)
B<--------- ^ \ | | | B | B | ^ | ^ | | | | BV BN BV BN ^ ^ ^ ^ | | | | \ / \ / C1 C2 \ / \ / - D -
(3)
B / \ / \ BV BN | \ / | | \/ | | / \ | | / \| C1 C2 \ / \ / D
If the intention is that it is (1), then is it not impossible to have any DAG that is not a tree? (i.e. diamond is not possible). If it would be better to call it a class tree?
If this is (2), it would not be enough to say "for each appearance of the base class in the class lattice there is a corresponding subobject of the base class". That is, if the construction of the lattice already depends on the relationship of the virtual and non-virtual base classes for selecting edges and vertices?
If this is (3), then this is not the language that is incorrect in the standard, because there can be only one appearance of a class in the class grid?