Added a test to ensure -Wimplicit-fallthrough works with -fblocks correctly.

llvm-svn: 211676
This commit is contained in:
Alexander Kornienko 2014-06-25 08:09:35 +00:00
parent 2ecf636073
commit 01ecd3107e
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=c++11 -Wimplicit-fallthrough %s
void fallthrough_in_blocks() {
void (^block)() = ^{
int x = 0;
switch (x) {
case 0:
x++;
[[clang::fallthrough]]; // no diagnostics
case 1:
x++;
default: // \
expected-warning{{unannotated fall-through between switch labels}} \
expected-note{{insert 'break;' to avoid fall-through}}
break;
}
};
block();
}