aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1999-09-13 10:12:07 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-09-13 06:12:07 -0400
commit50fd63433764915b611fd70630543abecd56b22d (patch)
treee6f867d99d5385ece9a7559f43e821c12c713526
parent0924404c5424a0cd34cfbc242d2d7ccf4ac80681 (diff)
downloadgcc-50fd63433764915b611fd70630543abecd56b22d.zip
gcc-50fd63433764915b611fd70630543abecd56b22d.tar.gz
gcc-50fd63433764915b611fd70630543abecd56b22d.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c24
2 files changed, 24 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5d11fe6..d2d8e77 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+1999-09-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_conditional_expr): Always use a TARGET_EXPR for
+ class rvalues again.
+
Sun Sep 12 23:29:07 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* 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 12f4b9b..bfc430d 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);