| 1 |
/* Test for anonymous structures and unions in C11. Test for invalid |
| 2 |
cases: typedefs disallowed by N1549. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-std=c11 -pedantic-errors" } */ |
| 5 |
|
| 6 |
typedef struct |
| 7 |
{ |
| 8 |
int i; |
| 9 |
} s0; |
| 10 |
|
| 11 |
typedef union |
| 12 |
{ |
| 13 |
int i; |
| 14 |
} u0; |
| 15 |
|
| 16 |
struct s1 |
| 17 |
{ |
| 18 |
int a; |
| 19 |
u0; /* { dg-error "declaration does not declare anything" } */ |
| 20 |
struct |
| 21 |
{ |
| 22 |
int b; |
| 23 |
}; |
| 24 |
}; |
| 25 |
|
| 26 |
union u1 |
| 27 |
{ |
| 28 |
int b; |
| 29 |
s0; /* { dg-error "declaration does not declare anything" } */ |
| 30 |
union |
| 31 |
{ |
| 32 |
int c; |
| 33 |
}; |
| 34 |
}; |