diff options
Diffstat (limited to 'test/SemaCXX/switch.cpp')
-rw-r--r-- | test/SemaCXX/switch.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/SemaCXX/switch.cpp b/test/SemaCXX/switch.cpp index 8a8cf33..517faa9 100644 --- a/test/SemaCXX/switch.cpp +++ b/test/SemaCXX/switch.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s void test() { bool x = true; @@ -64,3 +64,24 @@ void click_check_header_sizes() { case 0: ; } } + +void local_class(int n) { + for (;;) switch (n) { + case 0: + struct S { + void f() { + case 1: // expected-error {{'case' statement not in switch statement}} + break; // expected-error {{'break' statement not in loop or switch statement}} + default: // expected-error {{'default' statement not in switch statement}} + continue; // expected-error {{'continue' statement not in loop statement}} + } + }; + S().f(); + []{ + case 2: // expected-error {{'case' statement not in switch statement}} + break; // expected-error {{'break' statement not in loop or switch statement}} + default: // expected-error {{'default' statement not in switch statement}} + continue; // expected-error {{'continue' statement not in loop statement}} + }(); + } +} |