Add test for r263138.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 10 Mar 2016 19:22:21 +0000 (19:22 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 10 Mar 2016 19:22:21 +0000 (19:22 +0000)
llvm-svn: 263155

clang/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp [new file with mode: 0644]

diff --git a/clang/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp b/clang/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp
new file mode 100644 (file)
index 0000000..6ab6370
--- /dev/null
@@ -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;
+  }
+}