| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
// |
| 3 |
// There were two related problems here, depending on the vintage. At |
| 4 |
// one time: |
| 5 |
// |
| 6 |
// typedef struct A { ... } A [[gnu::aligned (16)]]; |
| 7 |
// |
| 8 |
// would cause original_types to go into an infinite loop. At other |
| 9 |
// times, the attributes applied to an explicit typedef would be lost |
| 10 |
// (check_b3 would have a negative size). |
| 11 |
|
| 12 |
// First check that the declaration is accepted and has an effect. |
| 13 |
typedef struct A { int i; } A [[gnu::aligned (16)]]; |
| 14 |
int check_A[alignof (A) >= 16 ? 1 : -1]; |
| 15 |
|
| 16 |
// Check that the alignment is only applied to the typedef. |
| 17 |
struct B { int i; }; |
| 18 |
struct B b1; |
| 19 |
typedef struct B B [[gnu::aligned (16)]]; |
| 20 |
struct B b2; |
| 21 |
B b3; |
| 22 |
int check_b1[__alignof__ (b1) == __alignof__ (b2) ? 1 : -1]; |
| 23 |
int check_b3[__alignof__ (b3) >= 16 ? 1 : -1]; |