2015-10-17 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / c-c++-common / attr-aligned-1.c
blob671e86baeb6075d2efbcc7b328ca210f1bc09768
1 /* PR c++/65690 */
2 /* { dg-do run } */
4 typedef double T[4][4] __attribute__((aligned (2 * __alignof__ (double))));
5 void foo (const T);
6 struct S { T s; };
8 int
9 main ()
11 if (__alignof__ (struct S) != 2 * __alignof__ (double)
12 || __alignof__ (T) != 2 * __alignof__ (double)
13 || __alignof__ (const struct S) != 2 * __alignof__ (double)
14 || __alignof__ (const T) != 2 * __alignof__ (double))
15 __builtin_abort ();
16 return 0;
19 #if defined(__cplusplus) && __cplusplus >= 201103L
20 static_assert (alignof (S) == 2 * alignof (double), "alignment of S");
21 static_assert (alignof (T) == 2 * alignof (double), "alignment of T");
22 static_assert (alignof (const S) == 2 * alignof (double), "alignment of const S");
23 static_assert (alignof (const T) == 2 * alignof (double), "alignment of const T");
24 #endif