| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
typedef char layout_type; |
| 4 |
|
| 5 |
template<class> struct A { |
| 6 |
layout_type member alignas (double) alignas (int); |
| 7 |
}; |
| 8 |
|
| 9 |
// Here, the spec says that A<int> should have the stricter alignment, |
| 10 |
// so that would be the alignment of 'double', not 'int'. |
| 11 |
static_assert (alignof (A<int>) == alignof (double), |
| 12 |
"alignment of struct A must be alignof (double)"); |
| 13 |
|
| 14 |
template<class> struct alignas (1) alignas (alignof (long double)) B { |
| 15 |
layout_type member; |
| 16 |
}; |
| 17 |
|
| 18 |
// Similarly, the B<int> should have the stricter alignment, so that would |
| 19 |
// so that would be the alignment of 'long double', not '1'. |
| 20 |
static_assert (alignof (B<int>) == alignof (long double), |
| 21 |
"alignment of struct A must be alignof (double double)"); |
| 22 |
|