diff options
author | Jason Merrill <jason@redhat.com> | 2003-05-07 11:00:10 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2003-05-07 11:00:10 -0400 |
commit | a65fd2d71bc27fe03217fa582f7a9e99ce60920d (patch) | |
tree | 8c2e0dd1454e7145521521030d4607ac2b8e68ba /gcc/cp | |
parent | ffea5d1e438e9f07d1a003c026a68513b1664f16 (diff) | |
download | gcc-a65fd2d71bc27fe03217fa582f7a9e99ce60920d.zip gcc-a65fd2d71bc27fe03217fa582f7a9e99ce60920d.tar.gz gcc-a65fd2d71bc27fe03217fa582f7a9e99ce60920d.tar.bz2 |
call.c (build_conditional_expr): Don't assume that the folded expression has result_type.
* call.c (build_conditional_expr): Don't assume that the folded
expression has result_type.
From-SVN: r66561
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 15ca7a6..4955d64 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2003-05-07 Jason Merrill <jason@redhat.com> + + * call.c (build_conditional_expr): Don't assume that the folded + expression has result_type. + 2003-05-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> * typeck.c (build_unary_op): Deal with const qualifier in diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 44683ff..5d7e3df 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3530,16 +3530,19 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3) valid_operands: result = fold (build (COND_EXPR, result_type, arg1, arg2, arg3)); + /* We can't use result_type below, as fold might have returned a + throw_expr. */ + /* Expand both sides into the same slot, hopefully the target of the ?: 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)) - result = build_target_expr_with_type (result, result_type); + if (!lvalue_p && IS_AGGR_TYPE (TREE_TYPE (result))) + result = get_target_expr (result); /* If this expression is an rvalue, but might be mistaken for an lvalue, we must add a NON_LVALUE_EXPR. */ if (!lvalue_p && real_lvalue_p (result)) - result = build1 (NON_LVALUE_EXPR, result_type, result); + result = build1 (NON_LVALUE_EXPR, TREE_TYPE (result), result); return result; } |