diff options
Diffstat (limited to 'test/SemaCXX/switch-implicit-fallthrough-blocks.cpp')
-rw-r--r-- | test/SemaCXX/switch-implicit-fallthrough-blocks.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/SemaCXX/switch-implicit-fallthrough-blocks.cpp b/test/SemaCXX/switch-implicit-fallthrough-blocks.cpp new file mode 100644 index 000000000000..9a16f2b4b402 --- /dev/null +++ b/test/SemaCXX/switch-implicit-fallthrough-blocks.cpp @@ -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(); +} |