1 /* Test C1X alignment support. Test invalid code. */ 2 /* { dg-do compile } */ 3 /* { dg-options "-std=c1x -pedantic-errors" } */ 4 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" } */ 10 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" } */ 14 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 (3) char k; /* { dg-error "power of 2" } */ 27 28 _Alignas ((void *) 1) char k; /* { dg-error "integer constant" } */ 29 int x; 30 _Alignas (x) char l; /* { dg-error "integer constant" } */ 31 32 _Alignas (0) struct s; /* { dg-error "does not redeclare tag" } */ 33 34 _Alignas (0) typedef int T; /* { dg-error "alignment specified for typedef" } */ 35 void func (_Alignas (0) int); /* { dg-error "alignment specified for unnamed parameter" } */ 36 void f2 (_Alignas (0) int parm2) {} /* { dg-error "alignment specified for parameter" } */ 37 void f3(void)38f3 (void) 39 { 40 register _Alignas (0) int reg; /* { dg-error "register" } */ 41 } 42 _Alignas (0) void f4 (void); /* { dg-error "alignment specified for function" } */ 43