This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH to build_target_expr_with_type for c++/12726
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 23 Oct 2003 02:39:48 -0400
- Subject: C++ PATCH to build_target_expr_with_type for c++/12726
We need to exempt CONSTRUCTORs as well, since they are a different
initialization path.
Tested x86_64-pc-linux-gnu, applied to trunk. Test in
g++.dg/ext/complit2.C.
2003-10-23 Jason Merrill <jason@redhat.com>
PR c++/12726
* tree.c (build_target_expr_with_type): Don't call force_rvalue
for CONSTRUCTORs.
*** tree.c.~1~ 2003-10-21 16:06:46.000000000 -0400
--- tree.c 2003-10-22 23:39:47.000000000 -0400
*************** build_target_expr_with_type (tree init,
*** 311,320 ****
if (TREE_CODE (init) == TARGET_EXPR)
return init;
else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type)
! && TREE_CODE (init) != COND_EXPR)
/* We need to build up a copy constructor call. COND_EXPR is a special
case because we already have copies on the arms and we don't want
! another one here. */
return force_rvalue (init);
slot = build_decl (VAR_DECL, NULL_TREE, type);
--- 311,322 ----
if (TREE_CODE (init) == TARGET_EXPR)
return init;
else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type)
! && TREE_CODE (init) != COND_EXPR
! && TREE_CODE (init) != CONSTRUCTOR)
/* We need to build up a copy constructor call. COND_EXPR is a special
case because we already have copies on the arms and we don't want
! another one here. A CONSTRUCTOR is aggregate initialization, which
! is handled separately. */
return force_rvalue (init);
slot = build_decl (VAR_DECL, NULL_TREE, type);