[RISCV] Rename a lambda to have plural nouns to reflect that it contains a loop. NFC
[llvm-project.git] / clang / test / Sema / warn-duplicate-enum.c
blob4a605b3d7ddf69308542d54aa79f3b2fe8191d6c
1 // RUN: %clang_cc1 %s -fsyntax-only -verify -Wduplicate-enum
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin %s -x c++ -DCPP -fsyntax-only -verify -Wduplicate-enum
3 enum A {
4 A1 = 0, // expected-note {{element 'A1' also has value 0}}
5 A2 = -1,
6 A3, // expected-warning {{element 'A3' has been implicitly assigned 0 which another element has been assigned}}
7 A4};
9 enum B {
10 B1 = -1, // expected-note {{element 'B1' also has value -1}}
11 B2, // expected-warning {{element 'B2' has been implicitly assigned 0 which another element has been assigned}}
12 B3,
13 B4 = -2,
14 B5, // expected-warning {{element 'B5' has been implicitly assigned -1 which another element has been assigned}}
15 B6 // expected-note {{element 'B6' also has value 0}}
18 enum C { C1, C2 = -1, C3 }; // expected-warning{{element 'C1' has been implicitly assigned 0 which another element has been assigned}} \
19 // expected-note {{element 'C3' also has value 0}}
21 enum D {
22 D1,
23 D2,
24 D3, // expected-warning{{element 'D3' has been implicitly assigned 2 which another element has been assigned}}
25 D4 = D2, // no warning
26 D5 = 2 // expected-note {{element 'D5' also has value 2}}
29 enum E {
30 E1,
31 E2 = E1,
32 E3 = E2
35 enum F {
36 F1,
37 F2,
38 FCount,
39 FMax = FCount - 1
42 enum G {
43 G1,
44 G2,
45 GMax = G2,
46 GCount = GMax + 1
49 enum {
50 H1 = 0,
51 H2 = -1,
52 H3,
53 H4};
55 enum {
56 I1 = -1,
57 I2,
58 I3,
59 I4 = -2,
60 I5,
64 enum { J1, J2 = -1, J3 };
66 enum {
67 K1,
68 K2,
69 K3,
70 K4 = K2,
71 K5 = 2
74 enum {
75 L1,
76 L2 = L1,
77 L3 = L2
80 enum {
81 M1,
82 M2,
83 MCount,
84 MMax = MCount - 1
87 enum {
88 N1,
89 N2,
90 NMax = N2,
91 NCount = NMax + 1
94 // PR15693
95 enum enum1 {
96 VALUE // expected-note{{previous definition is here}}
99 enum enum2 {
100 VALUE // expected-error{{redefinition of enumerator 'VALUE'}}
103 #ifdef CPP
104 enum BigEnumerators : long {
106 e2 = __LONG_MAX__,
108 #endif