| 1 |
/* PR101838 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-options "-std=gnu17 -Wpedantic -O0" } */ |
| 4 |
|
| 5 |
|
| 6 |
int bar0( |
| 7 |
int (*a)[*], |
| 8 |
int (*b)[sizeof(*a)] |
| 9 |
); |
| 10 |
|
| 11 |
|
| 12 |
int bar( |
| 13 |
struct f { /* { dg-warning "will not be visible outside of this definition" } */ |
| 14 |
int a[*]; } v, /* { dg-warning "variably modified type" } */ |
| 15 |
int (*b)[sizeof(struct f)] // should not warn about zero size |
| 16 |
); |
| 17 |
|
| 18 |
int foo(void) |
| 19 |
{ |
| 20 |
int n = 0; |
| 21 |
return sizeof(typeof(*({ n = 10; struct foo { /* { dg-warning "braced-groups" } */ |
| 22 |
int x[n]; /* { dg-warning "variably modified type" } */ |
| 23 |
} x; &x; }))); |
| 24 |
} |
| 25 |
|
| 26 |
|
| 27 |
int main() |
| 28 |
{ |
| 29 |
if (sizeof(struct foo { int x[10]; }) != foo()) |
| 30 |
__builtin_abort(); |
| 31 |
|
| 32 |
return 0; |
| 33 |
} |