gcc/testsuite/gcc.dg/c23-tag-enum-5.c
raw| 1 | /* { dg-do compile } |
| 2 | * { dg-options "-std=c23" } */ |
| 3 | |
| 4 | // test for nested redefinitions of enums |
| 5 | |
| 6 | void foo(void) |
| 7 | { |
| 8 | enum e { A = 1 }; |
| 9 | enum e { A = 1 /* { dg-error "redeclaration" } */ |
| 10 | + 0 * sizeof(enum e { A = 1 }) }; /* { dg-error "nested redefinition" } */ |
| 11 | |
| 12 | } |
| 13 | |
| 14 | typedef __SIZE_TYPE__ size_t; |
| 15 | enum f : typeof (sizeof (enum f : size_t { B })) { B }; /* { dg-error "nested redefinition" } */ |
| 16 | |
| 17 | |
| 18 |