| 1 |
// PR c++/88115 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-additional-options "-Wno-pedantic" } |
| 4 |
|
| 5 |
// Verify the non-standard extension alignof(expr) behaves like |
| 6 |
// alignof(type) to yield the ABI alignment of the type, and that |
| 7 |
// __alignof__(expr) behaves like __alignof__(type) to yield the |
| 8 |
// preferred alignment of the type. |
| 9 |
|
| 10 |
static_assert(alignof(double{}) == alignof(double), ""); |
| 11 |
static_assert(__alignof__(double{}) == __alignof__(double), ""); |
| 12 |
|
| 13 |
template <class T> |
| 14 |
void f() { |
| 15 |
static_assert(alignof(T{}) == alignof(T), ""); |
| 16 |
static_assert(__alignof__(T{}) == __alignof__(T), ""); |
| 17 |
} |
| 18 |
|
| 19 |
template void f<double>(); |