Debian Codegraph @

gcc/testsuite/gcc.dg/c23-tag-enum-4.c

raw
1 /* { dg-do compile }
2 * { dg-options "-std=c23" }
3 */
4
5 // fixed underlying types
6
7 enum A : int { N = 1 } x1 = { };
8 enum B : int { M = 1 } x2 = { };
9 enum C { U = 1 } x3 = { };
10
11 void f(void)
12 {
13 enum A : int { N = 1 } y1 = x1;
14 enum B : short { M = 1 } y2;
15 y2 = x2;
16 enum B : short { M = 1 } y2b;
17 enum Bb : short { V = 1 } y2d = x2;
18 enum B : short { M = 1 } *y2e = &x2; /* { dg-error "incompatible" } */
19 enum B : short { M = 1 } y2c = x2;
20 enum C { U = 1 } y3 = x3;
21 }
22