1 // RUN: %clang_cc1 -fsyntax-only -verify %s
4 default: z
--; // expected-error {{statement not in switch}}
10 case 42: ; // expected-note {{previous case}}
11 case 5000000000LL: // expected-warning {{overflow}}
12 case 42: // expected-error {{duplicate case value}}
15 case 100 ... 99: ; // expected-warning {{empty case range}}
17 case 43: ; // expected-note {{previous case}}
18 case 43 ... 45: ; // expected-error {{duplicate case value}}
20 case 100 ... 20000:; // expected-note {{previous case}}
21 case 15000 ... 40000000:; // expected-error {{duplicate case value}}
27 switch (0); // expected-warning {{no case matching constant switch condition '0'}}
42 case g(): // expected-error {{expression is not an integer constant expression}}
43 case 0 ... g(): // expected-error {{expression is not an integer constant expression}}
48 case 0 && g() ... 1 || g():
53 case g() && 0: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}}
58 case 0 ... g() || 1: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}}
65 default: // expected-note {{previous case defined here}}
66 default: // expected-error {{multiple default labels in one switch}}
74 case 1234: // expected-warning {{overflow converting case value}}
81 switch (va
) { // expected-error{{use of undeclared identifier 'va'}}
95 switch(a
) { //expected-warning{{enumeration value 'B' not handled in switch}}
107 case 3: // expected-warning{{case value not in enumerated type ''}}
113 case 3 ... //expected-warning{{case value not in enumerated type ''}}
114 4: //expected-warning{{case value not in enumerated type ''}}
122 case 0 ... 2: //expected-warning{{case value not in enumerated type ''}}
126 case 1 ... 3: //expected-warning{{case value not in enumerated type ''}}
130 case 0 ... //expected-warning{{case value not in enumerated type ''}}
131 3: //expected-warning{{case value not in enumerated type ''}}
153 switch(a
) { //expected-warning{{enumeration value 'B' not handled in switch}}
165 case 0: //expected-warning{{case value not in enumerated type ''}}
167 case 2: //expected-warning{{case value not in enumerated type ''}}
169 case 4: //expected-warning{{case value not in enumerated type ''}}
182 case 0 ... //expected-warning{{case value not in enumerated type ''}}
183 1: //expected-warning{{case value not in enumerated type ''}}
185 case 5 ... //expected-warning{{case value not in enumerated type ''}}
186 9: //expected-warning{{case value not in enumerated type ''}}
188 case 13 ... //expected-warning{{case value not in enumerated type ''}}
189 16: //expected-warning{{case value not in enumerated type ''}}
200 switch(a
) { //expected-warning{{enumeration value 'A' not handled in switch}}
228 // <rdar://problem/7643909>
235 int test13(my_type_t t
) {
236 switch(t
) { // expected-warning{{enumeration value 'val3' not handled in switch}}
245 // <rdar://problem/7658121>
259 void f1(unsigned x
) {
268 switch (1) { // expected-warning {{no case matching constant switch condition '1'}}
269 case 0: i
= 0; break;
276 switch (c
) { // expected-warning {{no case matching constant switch condition '53'}}
283 switch (x
>= 17) { // expected-warning {{switch condition has boolean value}}
287 switch ((int) (x
<= 17)) {