r211676 - Added a test to ensure -Wimplicit-fallthrough works with -fblocks correctly.
Alexander Kornienko
alexfh at google.com
Wed Jun 25 01:09:35 PDT 2014
Author: alexfh
Date: Wed Jun 25 03:09:35 2014
New Revision: 211676
URL: http://llvm.org/viewvc/llvm-project?rev=211676&view=rev
Log:
Added a test to ensure -Wimplicit-fallthrough works with -fblocks correctly.
Added:
cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-blocks.cpp
Added: cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-blocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-blocks.cpp?rev=211676&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-blocks.cpp (added)
+++ cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-blocks.cpp Wed Jun 25 03:09:35 2014
@@ -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();
+}
More information about the cfe-commits
mailing list