From: Gabriel Dos Reis Date: Sat, 13 Mar 2004 02:00:57 +0000 (+0000) Subject: backport: re PR c++/14230 (ICE in cp_expr_size) X-Git-Tag: releases/gcc-3.3.4~167 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7c6e677c19aa05dcd44390aaad66885dc5b13a6;p=thirdparty%2Fgcc.git backport: re PR c++/14230 (ICE in cp_expr_size) Backport: 2004-03-09 Mark Mitchell PR c++/14230 * call.c (initialize_reference): Handle initializers that are class-member access expressions applies to rvalues. From-SVN: r79425 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3025fdd3e5e5..762f1472b19d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2004-03-12 Gabriel Dos Reis + + Backport: + 2004-03-09 Mark Mitchell + PR c++/14230 + * call.c (initialize_reference): Handle initializers that are + class-member access expressions applies to rvalues. + 2004-03-12 Gabriel Dos Reis Backport: diff --git a/gcc/cp/call.c b/gcc/cp/call.c index a8e4457f15a1..e45d5aaee0cc 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6204,6 +6204,16 @@ initialize_reference (type, expr, decl, cleanup) type = TREE_TYPE (expr); var = make_temporary_var_for_ref_to_temp (decl, type); layout_decl (var, 0); + /* If the rvalue is the result of a function call it will be + a TARGET_EXPR. If it is some other construct (such as a + member access expression where the underlying object is + itself the result of a function call), turn it into a + TARGET_EXPR here. It is important that EXPR be a + TARGET_EXPR below since otherwise the INIT_EXPR will + attempt to make a bitwise copy of EXPR to intialize + VAR. */ + if (TREE_CODE (expr) != TARGET_EXPR) + expr = get_target_expr (expr); /* Create the INIT_EXPR that will initialize the temporary variable. */ init = build (INIT_EXPR, type, var, expr);