diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-10-31 23:55:28 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-10-31 23:55:28 +0000 |
commit | 889b99e6d5b389c0ed99e7ad8470c28b146a42d3 (patch) | |
tree | fb1ae55200b31f5d92e19c00d957a4db7da37453 /test/SemaCXX/scope-check.cpp | |
parent | bbb751a1788c461bc9765ec3387536cad6b52619 (diff) |
Correctly reject gotos in function-level try blocks. PR14225.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/scope-check.cpp')
-rw-r--r-- | test/SemaCXX/scope-check.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/SemaCXX/scope-check.cpp b/test/SemaCXX/scope-check.cpp index 78228c0dc5..8fd23f4efe 100644 --- a/test/SemaCXX/scope-check.cpp +++ b/test/SemaCXX/scope-check.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-unreachable-code -// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=gnu++11 %s -Wno-unreachable-code +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -fcxx-exceptions %s -Wno-unreachable-code +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -fcxx-exceptions -std=gnu++11 %s -Wno-unreachable-code namespace test0 { struct D { ~D(); }; @@ -260,3 +260,17 @@ namespace test14 { goto *ip; } } + +// PR14225 +namespace test15 { + void f1() try { + goto x; // expected-error {{goto into protected scope}} + } catch(...) { // expected-note {{jump bypasses initialization of catch block}} + x: ; + } + void f2() try { // expected-note {{jump bypasses initialization of try block}} + x: ; + } catch(...) { + goto x; // expected-error {{goto into protected scope}} + } +} |