gcc/testsuite/gcc.dg/gnu23-tag-enum-1.c
raw| 1 | /* |
| 2 | * { dg-do compile } |
| 3 | * { dg-options "-std=gnu23" } |
| 4 | */ |
| 5 | |
| 6 | |
| 7 | |
| 8 | void test2(void) |
| 9 | { |
| 10 | enum ee *a; |
| 11 | enum ee { F = 2 } *b; |
| 12 | b = a; |
| 13 | } |
| 14 | |
| 15 | |
| 16 | |
| 17 | enum A { B = 7 } y; |
| 18 | |
| 19 | void g(void) |
| 20 | { |
| 21 | // incomplete during construction |
| 22 | // this is a GNU extension because enum A is used |
| 23 | // before the type is completed. |
| 24 | |
| 25 | enum A { B = _Generic(&y, enum A*: 1, default: 7) }; |
| 26 | _Static_assert(7 == B, ""); |
| 27 | } |
| 28 | |
| 29 |