summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-06-25 08:09:35 +0000
committerAlexander Kornienko <alexfh@google.com>2014-06-25 08:09:35 +0000
commit9f074fb6303750e5405d0192115cc53aeca3e262 (patch)
tree6d4ec439ff45ef95177d2447b1e8145aeb22bb3e
parent3f3078bf289bec6116f4b43221e8aa7609106405 (diff)
downloadclang-9f074fb6303750e5405d0192115cc53aeca3e262.tar.gz
clang-9f074fb6303750e5405d0192115cc53aeca3e262.tar.bz2
clang-9f074fb6303750e5405d0192115cc53aeca3e262.tar.xz
Added a test to ensure -Wimplicit-fallthrough works with -fblocks correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211676 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/SemaCXX/switch-implicit-fallthrough-blocks.cpp19
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 0000000000..9a16f2b4b4
--- /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();
+}