17 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s2// expected-no-diagnostics3 4typedef struct S1 { char c; } S1 __attribute__((aligned(8)));5static_assert(alignof(S1) == 8, "attribute ignored");6static_assert(alignof(struct S1) == 1, "attribute applied to original type");7 8typedef struct __attribute__((aligned(8))) S2 { char c; } AS;9static_assert(alignof(S2) == 8, "attribute not propagated");10static_assert(alignof(struct S2) == 8, "attribute ignored");11 12typedef struct __attribute__((aligned(4))) S3 {13 char c;14} S3 __attribute__((aligned(8)));15static_assert(alignof(S3) == 8, "attribute ignored");16static_assert(alignof(struct S3) == 4, "attribute clobbered");17