After long grunts, I finally remembered something.
Optimization of an empty base .
As soon as A receives a member, the result will change. However, as long as it is absent, the compiler does not need to generate a real layout for A , all that matters is to ensure that each A βobjectβ has a different address from any other object A
Therefore, the compiler simply uses the sub-address of B (which inherits from A ) as a suitable address. And it turns out that B and C have the same address (first base + both have virtual methods).
On the other hand, if A has an OR element, if the first member of B is A (other conditions exist), then EBO can no longer be applied and you will notice a jump in addresses.
Matthieu M.
source share