From 9f074fb6303750e5405d0192115cc53aeca3e262 Mon Sep 17 00:00:00 2001 From: Alexander Kornienko Date: Wed, 25 Jun 2014 08:09:35 +0000 Subject: 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 --- test/SemaCXX/switch-implicit-fallthrough-blocks.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/SemaCXX/switch-implicit-fallthrough-blocks.cpp (limited to 'test') 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(); +} -- cgit v1.2.3