summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-05 03:28:14 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-05 03:28:14 +0000
commit5747d366787cc461b8b4b79b4575f22df9feaa03 (patch)
tree7b439ecb9236581bd4b64ccf943c6d9a7ce82aa0 /gcc/testsuite/g++.dg/init
parent8ff0f9e3a3d3efc8cbb71c34d56595b00b874726 (diff)
downloadgcc-5747d366787cc461b8b4b79b4575f22df9feaa03.tar.gz
PR c++/26714
* init.c (perform_member_init): Strip TARGET_EXPR around NSDMI. Do temporary lifetime extension. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181002 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/init')
-rw-r--r--gcc/testsuite/g++.dg/init/lifetime2.C23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/lifetime2.C b/gcc/testsuite/g++.dg/init/lifetime2.C
new file mode 100644
index 00000000000..293bd692e9c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/lifetime2.C
@@ -0,0 +1,23 @@
+// PR c++/26714
+// { dg-do run }
+
+extern "C" void abort();
+
+bool ok = false;
+struct A
+{
+ A() { }
+ ~A() { if (!ok) abort(); }
+};
+
+struct B
+{
+ const A &a1;
+ const A &a2;
+ B() : a1(A()),a2(A()) { ok = true; }
+};
+
+int main()
+{
+ B b;
+}