Debian Codegraph @

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

raw
1 /*
2 * { dg-do compile }
3 * { dg-options "-std=c23" }
4 */
5
6 // incompatible redeclarations, conflicing redefinitions
7
8
9 enum aa { A = 1 } *a;
10 enum bb { B = 1 } *b;
11
12 void test(void)
13 {
14 enum aa { A = 1 } *c = a;
15 enum bb { B = 2 } *d = b; /* { dg-error "incompatible pointer type" } */
16 }
17
18 enum cc { C = 1 };
19 enum cc { D = 1 }; /* { dg-error "conflicting redefinition" } */
20
21 enum dd { E = 1 };
22 enum dd { E = 2 }; /* { dg-error "conflicting redefinition" } */
23 /* { dg-error "redeclaration of enumerator" "" { target *-*-* } .-1 } */
24
25
26 enum ff { G = 2 };
27 enum gg { G = 2 }; /* { dg-error "redeclaration of enumerator" } */
28 enum g2 { G = 3 }; /* { dg-error "redeclaration of enumerator" } */
29
30 enum hh { H = 1, H = 1 }; /* { dg-error "redeclaration of enumerator" } */
31
32 enum ss { K = 2 };
33 enum ss { K = 2 };
34
35 enum tt { R = 2 } TT;
36 enum tt {
37 R = _Generic(&TT, enum tt*: 2, default: 0)
38 };
39
40 enum { U = 1 };
41 enum { U = 1 }; /* { dg-error "redeclaration of enumerator" } */
42
43 enum { V = 1 };
44 enum { V = 2 }; /* { dg-error "redeclaration of enumerator" } */
45
46
47