r263155 - Add test for r263138.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 11:22:22 PST 2016


Author: rsmith
Date: Thu Mar 10 13:22:21 2016
New Revision: 263155

URL: http://llvm.org/viewvc/llvm-project?rev=263155&view=rev
Log:
Add test for r263138.

Added:
    cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp

Added: cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp?rev=263155&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp (added)
+++ cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp Thu Mar 10 13:22:21 2016
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -DUNREACHABLE=1 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -DUNREACHABLE=0 -Wimplicit-fallthrough %s
+
+void fallthrough(int n) {
+  switch (n) {
+  case 1:
+    if (UNREACHABLE)
+      return;
+    [[fallthrough]]; // expected-no-diagnostics, only checked when UNREACHABLE=0
+  case 2:
+    break;
+  }
+}




More information about the cfe-commits mailing list