From: Jason Merrill Date: Mon, 13 Sep 1999 10:12:07 +0000 (+0000) Subject: call.c (build_conditional_expr): Always use a TARGET_EXPR for class rvalues again. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=50fd63433764915b611fd70630543abecd56b22d;p=gcc.git call.c (build_conditional_expr): Always use a TARGET_EXPR for class rvalues again. * call.c (build_conditional_expr): Always use a TARGET_EXPR for class rvalues again. From-SVN: r29372 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5d11fe63351..d2d8e7781ee 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1999-09-13 Jason Merrill + + * call.c (build_conditional_expr): Always use a TARGET_EXPR for + class rvalues again. + Sun Sep 12 23:29:07 1999 Kaveh R. Ghazi * Make-lang.in (g++spec.o): Depend on system.h and gcc.h. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 12f4b9bc7e2..bfc430de831 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2977,10 +2977,23 @@ build_conditional_expr (arg1, arg2, arg3) Lvalue-to-rvalue (_conv.lval_), array-to-pointer (_conv.array_), and function-to-pointer (_conv.func_) standard conversions are - performed on the second and third operands. */ - arg2 = decay_conversion (arg2); + performed on the second and third operands. + + We need to force the lvalue-to-rvalue conversion here for class types, + so we get TARGET_EXPRs; trying to deal with a COND_EXPR of class rvalues + that isn't wrapped with a TARGET_EXPR plays havoc with exception + regions. */ + + if (IS_AGGR_TYPE (TREE_TYPE (arg2)) && real_lvalue_p (arg2)) + arg2 = build_user_type_conversion (TREE_TYPE (arg2), arg2, LOOKUP_NORMAL); + else + arg2 = decay_conversion (arg2); arg2_type = TREE_TYPE (arg2); - arg3 = decay_conversion (arg3); + + if (IS_AGGR_TYPE (TREE_TYPE (arg3)) && real_lvalue_p (arg3)) + arg3 = build_user_type_conversion (TREE_TYPE (arg3), arg3, LOOKUP_NORMAL); + else + arg3 = decay_conversion (arg3); arg3_type = TREE_TYPE (arg3); /* [expr.cond] @@ -3061,8 +3074,9 @@ build_conditional_expr (arg1, arg2, arg3) valid_operands: result = fold (build (COND_EXPR, result_type, arg1, arg2, arg3)); /* Expand both sides into the same slot, hopefully the target of the - ?: expression. */ - if (TREE_CODE (arg2) == TARGET_EXPR && TREE_CODE (arg3) == TARGET_EXPR) + ?: expression. We used to check for TARGET_EXPRs here, but now we + sometimes wrap them in NOP_EXPRs so the test would fail. */ + if (!lvalue_p && IS_AGGR_TYPE (result_type)) { tree slot = build (VAR_DECL, result_type); layout_decl (slot, 0);