xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/attr-aligned.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc typedef struct S1 { char c; } S1 __attribute__((aligned(8)));
5*f4a2713aSLionel Sambuc static_assert(alignof(S1) == 8, "attribute ignored");
6*f4a2713aSLionel Sambuc static_assert(alignof(struct S1) == 1, "attribute applied to original type");
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc typedef struct __attribute__((aligned(8))) S2 { char c; } AS;
9*f4a2713aSLionel Sambuc static_assert(alignof(S2) == 8, "attribute not propagated");
10*f4a2713aSLionel Sambuc static_assert(alignof(struct S2) == 8, "attribute ignored");
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc typedef struct __attribute__((aligned(4))) S3 {
13*f4a2713aSLionel Sambuc   char c;
14*f4a2713aSLionel Sambuc } S3 __attribute__((aligned(8)));
15*f4a2713aSLionel Sambuc static_assert(alignof(S3) == 8, "attribute ignored");
16*f4a2713aSLionel Sambuc static_assert(alignof(struct S3) == 4, "attribute clobbered");
17