Merge from mainline
[official-gcc.git] / gcc / testsuite / g++.dg / parse / array-size2.C
blob22a57b2dc0bcebd325f9e85fdc7d9ccebf3d3b9e
1 // PR c/25682
2 // { dg-do compile }
3 // Test whether we don't ICE on invalid array sizes.
5 struct S
7   char a[4];
8   int b;
9 };
11 extern void bar (char *, char *);
13 void
14 foo (void)
16   char g[(char *) &((struct S *) 0)->b - (char *) 0];   // { dg-error "not an integral constant-expression" }
17   char h[(__SIZE_TYPE__) &((struct S *) 8)->b];         // { dg-error "not an integral constant-expression" }
18   bar (g, h);