sizeof (A): 8
3 bytes in the array, 1 byte strip, 4 bytes for vptr (pointer to vtable)
sizeof (B): 12
Subobject: 8, 3 bytes for an additional array, 1 byte strip
sizeof (C): 16
This is probably surprising for you ... Subobject: 8, 3 bytes for an additional array, 1 byte pad, 4 bytes of a pointer to A
, , , , . :
struct A {};
struct B : virtual A {};
struct C : virtual A {};
struct D : B, C {};
A B, B A B, D. , , , , A C C C D .
, ... Itanium ++ ABI ++. .
:
sizeof (D): 32
D B (12) C (16) 3 1.
, A, C A, , , , . B A, C .
, . A .