* tree.c (stabilize_expr): Handle xvalues properly.

From-SVN: r165969
This commit is contained in:
Jason Merrill 2010-10-26 11:02:54 -04:00 committed by Jason Merrill
parent 2dfa30b4c8
commit 883fff6cf7
2 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,7 @@
2010-10-26 Jason Merrill <jason@redhat.com>
* tree.c (stabilize_expr): Handle xvalues properly.
* call.c (build_over_call): Use argarray[0] for 'this' argument.
* decl.c (finish_function): Don't look at function_depth.

View File

@ -3018,18 +3018,23 @@ stabilize_expr (tree exp, tree* initp)
if (!TREE_SIDE_EFFECTS (exp))
init_expr = NULL_TREE;
else if (!real_lvalue_p (exp)
|| !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp)))
/* There are no expressions with REFERENCE_TYPE, but there can be call
arguments with such a type; just treat it as a pointer. */
else if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE
|| !lvalue_or_rvalue_with_address_p (exp))
{
init_expr = get_target_expr (exp);
exp = TARGET_EXPR_SLOT (init_expr);
}
else
{
bool xval = !real_lvalue_p (exp);
exp = cp_build_addr_expr (exp, tf_warning_or_error);
init_expr = get_target_expr (exp);
exp = TARGET_EXPR_SLOT (init_expr);
exp = cp_build_indirect_ref (exp, RO_NULL, tf_warning_or_error);
if (xval)
exp = move (exp);
}
*initp = init_expr;