summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-03-10 19:22:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-03-10 19:22:21 +0000
commit4d3d785e3f9713e700c94d6d78b5a695daa98f1d (patch)
treeb9ac8b92e894675e3162b7c06d1ffc72d35f165b
parent4058e8fbed18d9c2f7287b0334861d07972ce035 (diff)
downloadbcm5719-llvm-4d3d785e3f9713e700c94d6d78b5a695daa98f1d.tar.gz
bcm5719-llvm-4d3d785e3f9713e700c94d6d78b5a695daa98f1d.zip
Add test for r263138.
llvm-svn: 263155
-rw-r--r--clang/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp13
1 files changed, 13 insertions, 0 deletions
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
index 00000000000..6ab6370069a
--- /dev/null
+++ b/clang/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp
@@ -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;
+ }
+}
OpenPOWER on IntegriCloud