diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-01 20:59:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-01 20:59:53 +0000 |
commit | 30d0cfda354ec7f271ff3fa006db02d10a9e9610 (patch) | |
tree | af0b01ca1669547c4585763ce944fc02e09b6464 /clang/test/SemaCXX/statements.cpp | |
parent | 115da88f01a9014bc6f56bbf8d13536c318e969e (diff) | |
download | bcm5719-llvm-30d0cfda354ec7f271ff3fa006db02d10a9e9610.tar.gz bcm5719-llvm-30d0cfda354ec7f271ff3fa006db02d10a9e9610.zip |
Implement jump checking for initialized c++ variables, implementing
a fixme and PR6451.
Only perform jump checking if the containing function has no errors,
and add the infrastructure needed to do this.
On the testcase in the PR, we produce:
t.cc:6:3: error: illegal goto into protected scope
goto later;
^
t.cc:7:5: note: jump bypasses variable initialization
X x;
^
llvm-svn: 97497
Diffstat (limited to 'clang/test/SemaCXX/statements.cpp')
-rw-r--r-- | clang/test/SemaCXX/statements.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/statements.cpp b/clang/test/SemaCXX/statements.cpp index 36982582fa1..852086ed9a9 100644 --- a/clang/test/SemaCXX/statements.cpp +++ b/clang/test/SemaCXX/statements.cpp @@ -1,5 +1,17 @@ -// RUN: %clang_cc1 %s -fsyntax-only -pedantic +// RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify void foo() { return foo(); } + +// PR6451 - C++ Jump checking +struct X { + X(); +}; + +void test2() { + goto later; // expected-error {{illegal goto into protected scope}} + X x; // expected-note {{jump bypasses variable initialization}} +later: + ; +} |