Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / c11-align-3.c
blob39b81ef6f57511666e7111b0aee2a42d0cfb06c9
1 /* Test C11 alignment support. Test invalid code. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11 -pedantic-errors" } */
5 int a = _Alignof (void (void)); /* { dg-error "function" } */
6 struct s;
7 int b = _Alignof (struct s); /* { dg-error "incomplete" } */
8 int c = _Alignof (void); /* { dg-error "void" } */
9 int d = _Alignof (a); /* { dg-error "expression" } */
11 _Alignas (void (void)) char e; /* { dg-error "function" } */
12 _Alignas (struct s) char f; /* { dg-error "incomplete" } */
13 _Alignas (void) char g; /* { dg-error "void" } */
15 _Alignas (-__INT_MAX__-1) char h; /* { dg-error "too large|power of 2" } */
16 _Alignas (-__INT_MAX__) char h2; /* { dg-error "too large|power of 2" } */
17 _Alignas ((-__INT_MAX__-1)/2) char h3; /* { dg-error "too large|power of 2" } */
18 _Alignas ((-__INT_MAX__-1)/4) char h4; /* { dg-error "too large|power of 2" } */
19 _Alignas ((-__INT_MAX__-1)/8) char h5; /* { dg-error "too large|power of 2" } */
20 _Alignas (-__LONG_LONG_MAX__-1) char i; /* { dg-error "too large|power of 2" } */
21 _Alignas (-(__LONG_LONG_MAX__-1)/2) char i2; /* { dg-error "too large|power of 2" } */
22 _Alignas (-(__LONG_LONG_MAX__-1)/4) char i3; /* { dg-error "too large|power of 2" } */
23 _Alignas (-(__LONG_LONG_MAX__-1)/8) char i4; /* { dg-error "too large|power of 2" } */
24 _Alignas (-(__LONG_LONG_MAX__-1)/16) char i5; /* { dg-error "too large|power of 2" } */
25 _Alignas (-1) char j; /* { dg-error "power of 2" } */
26 _Alignas (-2) char j; /* { dg-error "positive power of 2" } */
27 _Alignas (3) char k; /* { dg-error "power of 2" } */
29 _Alignas ((void *) 1) char k; /* { dg-error "integer constant" } */
30 int x;
31 _Alignas (x) char l; /* { dg-error "integer constant" } */
33 _Alignas (0) struct s; /* { dg-error "does not redeclare tag" } */
35 _Alignas (0) typedef int T; /* { dg-error "alignment specified for typedef" } */
36 void func (_Alignas (0) int); /* { dg-error "alignment specified for unnamed parameter" } */
37 void f2 (_Alignas (0) int parm2) {} /* { dg-error "alignment specified for parameter" } */
38 void
39 f3 (void)
41 register _Alignas (0) int reg; /* { dg-error "register" } */
43 _Alignas (0) void f4 (void); /* { dg-error "alignment specified for function" } */