comparison clang/test/Sema/switch.c @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 1d019706d866
children c4bab56944e8
comparison
equal deleted inserted replaced
220:42394fc6a535 221:79ff65ed7e25
107 break; 107 break;
108 } 108 }
109 switch(a) { 109 switch(a) {
110 case A: 110 case A:
111 case B: 111 case B:
112 case 3: // expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 112 case 3: // expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
113 break; 113 break;
114 } 114 }
115 switch(a) { 115 switch(a) {
116 case A: 116 case A:
117 case B: 117 case B:
118 case 3 ... //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 118 case 3 ... //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
119 4: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 119 4: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
120 break; 120 break;
121 } 121 }
122 switch(a) { 122 switch(a) {
123 case 1 ... 2: 123 case 1 ... 2:
124 break; 124 break;
125 } 125 }
126 switch(a) { 126 switch(a) {
127 case 0 ... 2: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 127 case 0 ... 2: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
128 break; 128 break;
129 } 129 }
130 switch(a) { 130 switch(a) {
131 case 1 ... 3: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 131 case 1 ... 3: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
132 break; 132 break;
133 } 133 }
134 switch(a) { 134 switch(a) {
135 case 0 ... //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 135 case 0 ... //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
136 3: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 136 3: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
137 break; 137 break;
138 } 138 }
139 139
140 } 140 }
141 141
165 enum { 165 enum {
166 A = 3, 166 A = 3,
167 C = 1 167 C = 1
168 } a; 168 } a;
169 switch(a) { 169 switch(a) {
170 case 0: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 170 case 0: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
171 case 1: 171 case 1:
172 case 2: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 172 case 2: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
173 case 3: 173 case 3:
174 case 4: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 174 case 4: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
175 break; 175 break;
176 } 176 }
177 } 177 }
178 178
179 void test10() { 179 void test10() {
182 C = 2, 182 C = 2,
183 B = 4, 183 B = 4,
184 D = 12 184 D = 12
185 } a; 185 } a;
186 switch(a) { 186 switch(a) {
187 case 0 ... //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 187 case 0 ... //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
188 1: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 188 1: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
189 case 2 ... 4: 189 case 2 ... 4:
190 case 5 ... //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 190 case 5 ... //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
191 9: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 191 9: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
192 case 10 ... 12: 192 case 10 ... 12:
193 case 13 ... //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 193 case 13 ... //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
194 16: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}} 194 16: //expected-warning{{case value not in enumerated type 'enum (unnamed enum}}
195 break; 195 break;
196 } 196 }
197 } 197 }
198 198
199 void test11() { 199 void test11() {