| 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 |
| 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 |
char h[(__SIZE_TYPE__) &((struct S *) 8)->b]; // { dg-error "10:size of array .h. is not an integral constant-expression" } |
| 19 |
bar (g, h); |
| 20 |
} |