summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-12-23 22:56:40 +0000
committerDouglas Gregor <dgregor@apple.com>2010-12-23 22:56:40 +0000
commit0d0a965b62ca5acd4dddffc5621f998b291b80a4 (patch)
tree119d33c712974643be7eb223feb20c3693e5626c /clang/test
parent36be00ceb3c5cbb8fee4368fe424abbc4eaa4bf9 (diff)
downloadbcm5719-llvm-0d0a965b62ca5acd4dddffc5621f998b291b80a4.tar.gz
bcm5719-llvm-0d0a965b62ca5acd4dddffc5621f998b291b80a4.zip
Improve the diagnostic and recovery for missing colons after 'case'
and 'default' statements, including a Fix-It to add the colon: test/Parser/switch-recovery.cpp:13:12: error: expected ':' after 'case' case 17 // expected-error{{expected ':' after 'case'}} ^ : test/Parser/switch-recovery.cpp:16:12: error: expected ':' after 'default' default // expected-error{{expected ':' after 'default'}} ^ : llvm-svn: 122522
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Parser/switch-recovery.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/test/Parser/switch-recovery.cpp b/clang/test/Parser/switch-recovery.cpp
index 8eb4cff4fbe..7b6323a405c 100644
--- a/clang/test/Parser/switch-recovery.cpp
+++ b/clang/test/Parser/switch-recovery.cpp
@@ -3,10 +3,18 @@
// <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;
+ }
}
};
OpenPOWER on IntegriCloud