summaryrefslogtreecommitdiffstats
path: root/test/Parser/switch-recovery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser/switch-recovery.cpp')
-rw-r--r--test/Parser/switch-recovery.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/Parser/switch-recovery.cpp b/test/Parser/switch-recovery.cpp
index 8eb4cff..f11babc 100644
--- a/test/Parser/switch-recovery.cpp
+++ b/test/Parser/switch-recovery.cpp
@@ -3,10 +3,32 @@
// <rdar://problem/7971948>
struct A {};
struct B {
- void foo() {
+ void foo(int b) {
switch (a) { // expected-error{{use of undeclared identifier 'a'}}
default:
return;
}
+
+ switch (b) {
+ case 17 // expected-error{{expected ':' after 'case'}}
+ break;
+
+ default // expected-error{{expected ':' after 'default'}}
+ return;
+ }
+ }
+
+ 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;
+ }
}
};
OpenPOWER on IntegriCloud