diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-09-18 21:48:27 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-09-18 21:48:27 +0000 |
commit | 8b3c99e0167e0565905e1b05de2b8536d8e80d27 (patch) | |
tree | 9b39cfbb19904287823311451a363348d33a654d /test/SemaCXX/MicrosoftCompatibility.cpp | |
parent | 1c98d627e5f0b79365d4e64cd4c6795ebed895f3 (diff) |
Move the "jump bypasses variable initialization" error -> warning downgrade from -fms-extensions to -fms-compatibility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140008 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/MicrosoftCompatibility.cpp')
-rw-r--r-- | test/SemaCXX/MicrosoftCompatibility.cpp | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/test/SemaCXX/MicrosoftCompatibility.cpp b/test/SemaCXX/MicrosoftCompatibility.cpp index fa4ed3ebef..98a7532f0c 100644 --- a/test/SemaCXX/MicrosoftCompatibility.cpp +++ b/test/SemaCXX/MicrosoftCompatibility.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -verify -fms-compatibility +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -verify -fms-compatibility -fexceptions -fcxx-exceptions @@ -16,3 +16,57 @@ void test() } + + +namespace ms_protected_scope { + struct C { C(); }; + + int jump_over_variable_init(bool b) { + if (b) + goto foo; // expected-warning {{illegal goto into protected scope}} + C c; // expected-note {{jump bypasses variable initialization}} + foo: + return 1; + } + +struct Y { + ~Y(); +}; + +void jump_over_var_with_dtor() { + goto end; // expected-warning{{goto into protected scope}} + Y y; // expected-note {{jump bypasses variable initialization}} + end: + ; +} + + void jump_over_variable_case(int c) { + switch (c) { + case 0: + int x = 56; // expected-note {{jump bypasses variable initialization}} + case 1: // expected-error {{switch case is in protected scope}} + x = 10; + } + } + + +void exception_jump() { + goto l2; // expected-error {{illegal goto into protected scope}} + try { // expected-note {{jump bypasses initialization of try block}} + l2: ; + } catch(int) { + } +} + +int jump_over_indirect_goto() { + static void *ps[] = { &&a0 }; + goto *&&a0; // expected-warning {{goto into protected scope}} + int a = 3; // expected-note {{jump bypasses variable initialization}} + a0: + return 0; +} + +} + + + |