From 20888def1b70428012f4163348d294cdb94ca5f8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 9 Jul 2011 13:01:11 -0400 Subject: [PATCH] * tree.c (build_vec_init_elt): Strip TARGET_EXPR. From-SVN: r176084 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/tree.c | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/regress/regress5.C | 16 ++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/regress5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cbdc4d83df2..c19e8b38762 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2011-07-09 Jason Merrill + + * tree.c (build_vec_init_elt): Strip TARGET_EXPR. + 2011-07-08 Jason Merrill PR c++/45437 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index dcd85e40c98..4ef89c45f65 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -511,6 +511,11 @@ build_vec_init_elt (tree type, tree init, tsubst_flags_t complain) complain); release_tree_vector (argvec); + /* For a trivial constructor, build_over_call creates a TARGET_EXPR. But + we don't want one here because we aren't creating a temporary. */ + if (TREE_CODE (init) == TARGET_EXPR) + init = TARGET_EXPR_INITIAL (init); + return init; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5b8be3309cb..badb65e8163 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-07-09 Jason Merrill + + * g++.dg/cpp0x/regress/regress5.C: New. + 2011-07-08 Jason Merrill PR c++/45437 diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/regress5.C b/gcc/testsuite/g++.dg/cpp0x/regress/regress5.C new file mode 100644 index 00000000000..b1935912d6a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/regress5.C @@ -0,0 +1,16 @@ +// { dg-options -std=c++0x } + +struct A +{ + int i; + A(int); +}; + +struct B +{ + virtual void f(); + A ar[3]; +}; + +extern B b; +B b2(b); -- 2.30.2