summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/switch-recovery.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-01-22 09:28:32 +0000
committerJohn McCall <rjmccall@apple.com>2011-01-22 09:28:32 +0000
commit0140bfeead0452e7144e449b86f3fa581a020617 (patch)
treebfbe86269bf532f413d03e2ca696d33f4f82187b /clang/test/Parser/switch-recovery.cpp
parent6ed95945edea5f40fa5aedb3b049bb3d78dcce4e (diff)
downloadbcm5719-llvm-0140bfeead0452e7144e449b86f3fa581a020617.tar.gz
bcm5719-llvm-0140bfeead0452e7144e449b86f3fa581a020617.zip
Improve our parse recovery on 'case blah;' and 'default;'.
llvm-svn: 124025
Diffstat (limited to 'clang/test/Parser/switch-recovery.cpp')
-rw-r--r--clang/test/Parser/switch-recovery.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Parser/switch-recovery.cpp b/clang/test/Parser/switch-recovery.cpp
index 7b6323a405c..f11babc5b60 100644
--- a/clang/test/Parser/switch-recovery.cpp
+++ b/clang/test/Parser/switch-recovery.cpp
@@ -17,4 +17,18 @@ struct B {
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