| 1 |
/* { dg-do compile } |
| 2 |
* { dg-options "-std=c23" } |
| 3 |
*/ |
| 4 |
|
| 5 |
// anonymous structs / unions |
| 6 |
|
| 7 |
extern struct foo { int (*x)[]; struct { int y; }; } a; |
| 8 |
extern struct foo { int (*x)[]; struct { int y; }; } a; |
| 9 |
extern struct bar { int (*x)[]; union { int y; }; } b; |
| 10 |
extern struct bar { int (*x)[]; union { int y; }; } b; |
| 11 |
|
| 12 |
void f(void) |
| 13 |
{ |
| 14 |
struct foo { int (*x)[1]; struct { int y; }; } c; |
| 15 |
extern typeof(*(1 ? &a : &c)) a; |
| 16 |
a.y; |
| 17 |
|
| 18 |
struct bar { int (*x)[1]; union { int y; }; } d; |
| 19 |
extern typeof(*(1 ? &b : &d)) b; |
| 20 |
b.y; |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
struct foo { int (*x)[]; union { int y; }; }; /* { dg-error "redefinition" } */ |
| 25 |
|