2010-05-21 07:20:59 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
|
|
|
|
// <rdar://problem/7971948>
|
|
|
|
struct A {};
|
|
|
|
struct B {
|
2010-12-24 06:56:40 +08:00
|
|
|
void foo(int b) {
|
2010-05-21 07:20:59 +08:00
|
|
|
switch (a) { // expected-error{{use of undeclared identifier 'a'}}
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2010-12-24 06:56:40 +08:00
|
|
|
|
|
|
|
switch (b) {
|
|
|
|
case 17 // expected-error{{expected ':' after 'case'}}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default // expected-error{{expected ':' after 'default'}}
|
|
|
|
return;
|
|
|
|
}
|
2010-05-21 07:20:59 +08:00
|
|
|
}
|
2011-01-22 17:28:32 +08:00
|
|
|
|
|
|
|
void test2() {
|
|
|
|
enum X { Xa, Xb } x;
|
|
|
|
|
|
|
|
switch (x) { // expected-warning {{enumeration value 'Xb' not handled in switch}}
|
|
|
|
case Xa; // expected-error {{expected ':' after 'case'}}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (x) {
|
|
|
|
default; // expected-error {{expected ':' after 'default'}}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-05-21 07:20:59 +08:00
|
|
|
};
|