summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-05-27 21:28:00 +0000
committerDouglas Gregor <dgregor@apple.com>2011-05-27 21:28:00 +0000
commit22ae696be7927ed8cedc9e710c7763b5859f5740 (patch)
treeae3c8130c6b92ae8152da4528c91e2585d33a292 /clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
parenta9effb13ddc7b008a99981b3639a65ec91a1a35c (diff)
downloadbcm5719-llvm-22ae696be7927ed8cedc9e710c7763b5859f5740.tar.gz
bcm5719-llvm-22ae696be7927ed8cedc9e710c7763b5859f5740.zip
Clean up my changes to jump-diagnostic handling for local variables of
class type (or array thereof), eliminating some redundant checks (thanks Eli!) and adding some tests where the behavior differs in C++98/03 vs. C++0x. llvm-svn: 132218
Diffstat (limited to 'clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp')
-rw-r--r--clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp b/clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
index 2cf745e4506..18fd34039ee 100644
--- a/clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
+++ b/clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
@@ -1,12 +1,11 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
// PR10034
struct X {};
void exx(X) {}
-int main(int argc, char **argv)
+int test_ptr10034(int argc, char **argv)
{
if (argc > 3)
goto end;
@@ -24,3 +23,25 @@ int main(int argc, char **argv)
}
return 0;
}
+
+struct Y {
+ ~Y();
+};
+
+void test_Y() {
+ goto end; // expected-error{{goto into protected scope}}
+ Y y; // expected-note{{jump bypasses variable initialization}}
+ end:
+ return;
+}
+
+struct Z {
+ Z operator=(const Z&);
+};
+
+void test_Z() {
+ goto end; // expected-error{{goto into protected scope}}
+ Z z; // expected-note{{jump bypasses variable initialization}}
+ end:
+ return;
+}
OpenPOWER on IntegriCloud