1 // PR c/25682
2 // { dg-do compile }
3 // Test whether we don't ICE on questionable constructs where offsetof
4 // should have been used instead.
5 
6 struct S
7 {
8   char a[4];
9   int b;
10 };
11 
12 extern void bar (char *, char *);
13 
14 void
foo(void)15 foo (void)
16 {
17   char g[(char *) &((struct S *) 0)->b - (char *) 0]; // { dg-error "40:size of array .g. is not an integral constant-expression" }
18 						      // { dg-error "narrowing conversion" "" { target c++11 } .-1 }
19 						      // { dg-message "expression has a constant value but is not a C.. constant-expression" "" { target c++11 } .-2 }
20   char h[(__SIZE_TYPE__) &((struct S *) 8)->b];	      // { dg-error "10:size of array .h. is not an integral constant-expression" }
21   bar (g, h);
22 }
23