24 lines · cpp
1struct B1 {2 char f1;3};4 5struct alignas(8) B2 {6 char f2;7};8 9struct D : B1, B2 {};10 11D d3g;12 13struct alignas(8) EmptyClassAlign8 {14} t;15 16struct alignas(8) __attribute__((packed)) AlignedAndPackedBase {17} foo;18 19struct Derived : AlignedAndPackedBase {20} bar;21static_assert(alignof(Derived) == 8);22 23int main() {}24