aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2003-12-18 16:03:42 -0500
committerJason Merrill <jason@gcc.gnu.org>2003-12-18 16:03:42 -0500
commitd20db242047837c79801fc3caaddc43a1fe95378 (patch)
tree297f97f5645cfbbbb995c6e2665df951c2c59ce7
parenta3bf324c4674ca8a2d09f739c48be2cc59f1a789 (diff)
downloadgcc-d20db242047837c79801fc3caaddc43a1fe95378.zip
gcc-d20db242047837c79801fc3caaddc43a1fe95378.tar.gz
gcc-d20db242047837c79801fc3caaddc43a1fe95378.tar.bz2
re PR c++/12253 ([tree-ssa] ICE on conversion to std::string inside array initialization)
PR c++/12253 * init.c (build_vec_init): Initialization of an element from an initializer list is also a full-expression. From-SVN: r74798
-rw-r--r--gcc/testsuite/g++.dg/init/array12.C28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/array12.C b/gcc/testsuite/g++.dg/init/array12.C
new file mode 100644
index 0000000..3bb4800
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/array12.C
@@ -0,0 +1,28 @@
+// PR c++/12253
+// Bug: We were failing to destroy the temporary A passed to the
+// constructor for b[0] before going on to construct b[1].
+
+// { dg-do run }
+
+extern "C" int printf (const char *, ...);
+
+int c;
+int r;
+
+struct A
+{
+ A() { printf ("A()\n"); if (c++) r = 1; }
+ A(const A&) { printf ("A(const A&)\n"); ++c; }
+ ~A() { printf ("~A()\n"); --c; }
+};
+
+struct B
+{
+ B(int, const A& = A()) { printf ("B()\n"); }
+};
+
+int main()
+{
+ B b[] = { 0, 0 };
+ return r;
+}