1// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 2// expected-no-diagnostics 3 4// Test that the alignment of a empty direct base class is correctly 5// inherited by the derived class. 6 7struct A { 8} __attribute__ ((aligned(16))); 9 10static_assert(__alignof(A) == 16, "A should be aligned to 16 bytes"); 11 12struct B1 : public A { 13}; 14 15static_assert(__alignof(B1) == 16, "B1 should be aligned to 16 bytes"); 16 17struct B2 : public A { 18} __attribute__ ((aligned(2))); 19 20static_assert(__alignof(B2) == 16, "B2 should be aligned to 16 bytes"); 21 22struct B3 : public A { 23} __attribute__ ((aligned(4))); 24 25static_assert(__alignof(B3) == 16, "B3 should be aligned to 16 bytes"); 26 27struct B4 : public A { 28} __attribute__ ((aligned(8))); 29 30static_assert(__alignof(B4) == 16, "B4 should be aligned to 16 bytes"); 31 32struct B5 : public A { 33} __attribute__ ((aligned(16))); 34 35static_assert(__alignof(B5) == 16, "B5 should be aligned to 16 bytes"); 36 37struct B6 : public A { 38} __attribute__ ((aligned(32))); 39 40static_assert(__alignof(B6) == 32, "B6 should be aligned to 32 bytes"); 41 42