From 1d90e7928e4ac19f9f3615eb69487639b51d9e26 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 10 Mar 2016 19:22:21 +0000 Subject: [PATCH] Add test for r263138. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263155 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../switch-implicit-fallthrough-off-by-default.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp diff --git a/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp b/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp new file mode 100644 index 0000000000..6ab6370069 --- /dev/null +++ b/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; + } +}