1 /* Test C11 alignment support. Test invalid code. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11 -pedantic-errors" } */
4
5 void foo (int []);
6 void bar1 (int [_Alignas (double) 10]); /* { dg-error "expected expression before" } */
7 void bar2 (int [static _Alignas (double) 10]); /* { dg-error "expected expression before" } */
8 void bar3 (int [static const _Alignas (double) 10]); /* { dg-error "expected expression before" } */
9 void bar4 (int [const _Alignas (double) 10]); /* { dg-error "expected expression before" } */
10 void bar5 (int [_Alignas (0) *]); /* { dg-error "expected expression before" } */
11
foo(int a[_Alignas (0)10])12 void foo (int a[_Alignas (0) 10]) { } /* { dg-error "expected expression before" } */
13
14 void
test(void)15 test (void)
16 {
17 int *_Alignas (long) p; /* { dg-error "expected" } */
18 int *const _Alignas (long) *q; /* { dg-error "expected" } */
19 struct s { int n; };
20 __builtin_offsetof (struct s _Alignas (int), n); /* { dg-error "expected" } */
21 __typeof (long double _Alignas (0)) e; /* { dg-error "expected" } */
22 sizeof (int _Alignas (int)); /* { dg-error "specified for type name" } */
23 _Alignas (int _Alignas (float)) int t; /* { dg-error "expected" } */
24 __builtin_types_compatible_p (signed _Alignas (0), unsigned); /* { dg-error "expected" } */
25 int a[_Alignas (int) 10]; /* { dg-error "expected expression before" } */
26 int b[10];
27 foo (b);
28 }
29