blob: a55831d462a1a691ebc8b44c6485ae1a9176affb [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 ;
15 }
16}
17
Chris Lattner2b1b9a82007-08-23 14:29:07 +000018void test3(void) {
19 switch (0);
20}
21