diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-12-23 22:56:40 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-12-23 22:56:40 +0000 |
commit | 662a4822ee7c8696434b054303c5076a606ab175 (patch) | |
tree | b8610ed895bb1530766b3c9f964aa53771b0953c /test/Parser/switch-recovery.cpp | |
parent | a8bc8c9e9ba5bffebde00340786fe8542469c435 (diff) | |
download | clang-662a4822ee7c8696434b054303c5076a606ab175.tar.gz |
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'}}
^
:
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122522 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/switch-recovery.cpp')
-rw-r--r-- | test/Parser/switch-recovery.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/Parser/switch-recovery.cpp b/test/Parser/switch-recovery.cpp index 8eb4cff4fb..7b6323a405 100644 --- a/test/Parser/switch-recovery.cpp +++ b/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; + } } }; |