diff options
Diffstat (limited to 'clang/test/SemaCXX/switch-implicit-fallthrough.cpp')
-rw-r--r-- | clang/test/SemaCXX/switch-implicit-fallthrough.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/switch-implicit-fallthrough.cpp b/clang/test/SemaCXX/switch-implicit-fallthrough.cpp index 0bc43cdbd45..a547dc6d9f8 100644 --- a/clang/test/SemaCXX/switch-implicit-fallthrough.cpp +++ b/clang/test/SemaCXX/switch-implicit-fallthrough.cpp @@ -1,6 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wimplicit-fallthrough %s - int fallthrough(int n) { switch (n / 10) { if (n - 1) { @@ -300,3 +299,8 @@ int fallthrough_targets(int n) { } return n; } + +[[clang::fallthrough]] int a; // expected-error {{'fallthrough' attribute only applies to empty statements}} +[[clang::fallthrough]] int f(); // expected-error {{'fallthrough' attribute only applies to empty statements}} +void g([[clang::fallthrough]] int p); // expected-error {{'fallthrough' attribute only applies to empty statements}} +struct [[clang::fallthrough]] S; // expected-error {{'fallthrough' attribute only applies to empty statements}} |