Justin Bogner | 2dd68de | 2013-10-08 00:19:09 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | typedef struct S1 { char c; } S1 __attribute__((aligned(8))); |
| 5 | static_assert(alignof(S1) == 8, "attribute ignored"); |
| 6 | static_assert(alignof(struct S1) == 1, "attribute applied to original type"); |
| 7 | |
| 8 | typedef struct __attribute__((aligned(8))) S2 { char c; } AS; |
| 9 | static_assert(alignof(S2) == 8, "attribute not propagated"); |
| 10 | static_assert(alignof(struct S2) == 8, "attribute ignored"); |
| 11 | |
| 12 | typedef struct __attribute__((aligned(4))) S3 { |
| 13 | char c; |
| 14 | } S3 __attribute__((aligned(8))); |
| 15 | static_assert(alignof(S3) == 8, "attribute ignored"); |
| 16 | static_assert(alignof(struct S3) == 4, "attribute clobbered"); |