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 | 1e95d4bb1e748216e07006e9084a7b181883e286 (patch) | |
tree | bd3caa74b70fcc310103ae3e7cdcd41e44346df0 /clang/test/SemaCXX/scope-check.cpp | |
parent | d9c2370b33c9e6640f35b0ef5ac97497f5ab3cab (diff) | |
download | bcm5719-llvm-1e95d4bb1e748216e07006e9084a7b181883e286.tar.gz bcm5719-llvm-1e95d4bb1e748216e07006e9084a7b181883e286.zip |
Correctly reject gotos in function-level try blocks. PR14225.
llvm-svn: 167184
Diffstat (limited to 'clang/test/SemaCXX/scope-check.cpp')
-rw-r--r-- | clang/test/SemaCXX/scope-check.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/scope-check.cpp b/clang/test/SemaCXX/scope-check.cpp index 78228c0dc5f..8fd23f4efe9 100644 --- a/clang/test/SemaCXX/scope-check.cpp +++ b/clang/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}} + } +} |