From 30d0cfda354ec7f271ff3fa006db02d10a9e9610 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 1 Mar 2010 20:59:53 +0000 Subject: 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 --- clang/test/SemaCXX/statements.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'clang/test/SemaCXX/statements.cpp') 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: + ; +} -- cgit v1.2.3