re PR c++/9440 (error message about "non-lvalue in unary '&'" when using ?: operator)
authorJason Merrill <jason@redhat.com>
Wed, 5 Mar 2003 23:03:44 +0000 (18:03 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 5 Mar 2003 23:03:44 +0000 (18:03 -0500)
        PR c++/9440
        * call.c (build_conditional_expr): Use convert rather than an
        explicit NOP_EXPR.

From-SVN: r63872

gcc/cp/ChangeLog
gcc/cp/call.c

index d874ac06ec9b792c936b74279ff3f7d9f454bb03..5e04f442428cb7fef7e64e26e334ee4b75a444e3 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-05  Jason Merrill  <jason@redhat.com>
+
+       PR c++/9440
+       * call.c (build_conditional_expr): Use convert rather than an
+       explicit NOP_EXPR.
+
 2003-03-02  Matt Austern  <austern@apple.com>
 
        * decl.c (cp_binding_level): Add static_decls varray member.
index d59a320f28108b78ac3f9c8fa9ac731c5a641365..fe2686683ccac25e208d9444801cbbfeb7f4d9a9 100644 (file)
@@ -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);
        }
     }