| 1 |
/* Test diagnostics for variably modified function return types. PR |
| 2 |
39564. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-std=c99" } */ |
| 5 |
|
| 6 |
int a; |
| 7 |
|
| 8 |
void |
| 9 |
f1 (void) |
| 10 |
{ |
| 11 |
typedef int T[a]; |
| 12 |
extern T *g1 (void); /* { dg-error "non-nested function with variably modified type" } */ |
| 13 |
} |
| 14 |
|
| 15 |
void |
| 16 |
f2 (void) |
| 17 |
{ |
| 18 |
extern int (*g2 (void))[a]; /* { dg-error "non-nested function with variably modified type" } */ |
| 19 |
} |
| 20 |
|
| 21 |
void |
| 22 |
f3 (void) |
| 23 |
{ |
| 24 |
typedef int T[a]; |
| 25 |
T *g3 (void); /* { dg-error "non-nested function with variably modified type" } */ |
| 26 |
} |
| 27 |
|
| 28 |
void |
| 29 |
f4 (void) |
| 30 |
{ |
| 31 |
int (*g4 (void))[a]; /* { dg-error "non-nested function with variably modified type" } */ |
| 32 |
} |