blob: 0128a216e5a32aae8841c0d7c54c6b2a90b349e2 [file] [log] [blame]
Chris Lattner4b009652007-07-25 00:24:17 +00001// RUN: clang -parse-ast-check %s
2
Chris Lattner4b009652007-07-25 00:24:17 +00003void f (int z) {
4 while (z) {
5 default: z--; // expected-error {{statement not in switch}}
6 }
7}
8
Chris Lattner3429a812007-08-23 05:46:52 +00009void foo(int X) {
10 switch (X) {
Chris Lattner1a4066d2007-08-23 06:23:56 +000011 case 42: ; // expected-error {{previous case value}}
Chris Lattner3429a812007-08-23 05:46:52 +000012 case 5000000000LL: // expected-warning {{overflow}}
Chris Lattner1a4066d2007-08-23 06:23:56 +000013 case 42: // expected-error {{duplicate case value}}
Chris Lattner3429a812007-08-23 05:46:52 +000014 ;
Chris Lattner7443e0f2007-08-23 17:48:14 +000015
16 case 100 ... 99: ; // expected-warning {{empty case range}}
Chris Lattner3429a812007-08-23 05:46:52 +000017 }
18}
19
Chris Lattner2b1b9a82007-08-23 14:29:07 +000020void test3(void) {
21 switch (0);
22}
23