diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
| commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
| tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp | |
| parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) | |
Notes
Diffstat (limited to 'test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp')
| -rw-r--r-- | test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
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 000000000000..6ab6370069af --- /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; + } +} |
