From c965b169438a609791fa0b0922b8aea3adb37c4d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 5 Mar 2003 18:03:44 -0500 Subject: re PR c++/9440 (error message about "non-lvalue in unary '&'" when using ?: operator) PR c++/9440 * call.c (build_conditional_expr): Use convert rather than an explicit NOP_EXPR. From-SVN: r63872 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/call.c | 10 +++------- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d874ac0..5e04f44 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-03-05 Jason Merrill + + PR c++/9440 + * call.c (build_conditional_expr): Use convert rather than an + explicit NOP_EXPR. + 2003-03-02 Matt Austern * decl.c (cp_binding_level): Add static_decls varray member. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index d59a320..fe26866 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3112,13 +3112,9 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3) arg2 = convert_from_reference (arg2); /* That may not quite have done the trick. If the two types are cv-qualified variants of one another, we will have - just used an IDENTITY_CONV. (There's no conversion from - an lvalue of one class type to an lvalue of another type, - even a cv-qualified variant, and we don't want to lose - lvalue-ness here.) So, we manually add a NOP_EXPR here - if necessary. */ + just used an IDENTITY_CONV. */ if (!same_type_p (TREE_TYPE (arg2), arg3_type)) - arg2 = build1 (NOP_EXPR, arg3_type, arg2); + arg2 = convert (arg3_type, arg2); arg2_type = TREE_TYPE (arg2); } else if (conv3 && !ICS_BAD_FLAG (conv3)) @@ -3126,7 +3122,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3) arg3 = convert_like (conv3, arg3); arg3 = convert_from_reference (arg3); if (!same_type_p (TREE_TYPE (arg3), arg2_type)) - arg3 = build1 (NOP_EXPR, arg2_type, arg3); + arg3 = convert (arg2_type, arg3); arg3_type = TREE_TYPE (arg3); } } -- cgit v1.1