call.c (build_conditional_expr): Fix typo.
authorJason Merrill <jason@yorick.cygnus.com>
Tue, 24 Aug 1999 21:23:56 +0000 (21:23 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 24 Aug 1999 21:23:56 +0000 (17:23 -0400)
* call.c (build_conditional_expr): Fix typo.
* typeck.c (build_modify_expr, COND_EXPR): Make sure we've got an
lvalue before trying to mess with the sides.

* error.c (dump_expr, CONVERT_EXPR): Handle (void) properly.

From-SVN: r28826

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/error.c
gcc/cp/typeck.c

index 8ceb65995c00a3419019562d5a27afa34791898a..9f13fc9304744a6f087af663fefdb68803f9bc9f 100644 (file)
@@ -1,3 +1,11 @@
+1999-08-24  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * call.c (build_conditional_expr): Fix typo.
+       * typeck.c (build_modify_expr, COND_EXPR): Make sure we've got an
+       lvalue before trying to mess with the sides.
+
+       * error.c (dump_expr, CONVERT_EXPR): Handle (void) properly.
+
 Mon Aug 23 22:17:20 1999  Mumit Khan  <khan@xraylith.wisc.edu>
 
        * g++spec.c (lang_specific_driver): Add room for NULL in arglist.
index f193a4b7b162b748fd7d164619bb7c5a0afaec95..eed211f884ae235e4fbbdfacaa8a9e280d925e19 100644 (file)
@@ -2825,7 +2825,7 @@ build_conditional_expr (arg1, arg2, arg3)
       if ((TREE_CODE (arg2) == THROW_EXPR)
          ^ (TREE_CODE (arg3) == THROW_EXPR))
        result_type = ((TREE_CODE (arg2) == THROW_EXPR) 
-                      ? arg2_type : arg3_type);
+                      ? arg3_type : arg2_type);
       else if (arg2_void_p && arg3_void_p)
        result_type = void_type_node;
       else
index b6598ff30a4bece6c0b8d5173681f85dea5fc362..5b37717329cfb5b88eaff11bd9a14e224186dfb5 100644 (file)
@@ -1547,7 +1547,13 @@ dump_expr (t, nop)
       break;
 
     case CONVERT_EXPR:
-      dump_unary_op ("+", t, nop);
+      if (same_type_p (TREE_TYPE (t), void_type_node))
+       {
+         OB_PUTS ("(void)");
+         dump_expr (TREE_OPERAND (t, 0), 0);
+       }
+      else
+       dump_unary_op ("+", t, nop);
       break;
 
     case ADDR_EXPR:
index 8ebeed3fa45df0438c561458ecf32a0d6be7d755..cc476b208b49fe825505690b6a63277466cec295 100644 (file)
@@ -5734,12 +5734,22 @@ build_modify_expr (lhs, modifycode, rhs)
        /* Produce (a ? (b = rhs) : (c = rhs))
           except that the RHS goes through a save-expr
           so the code to compute it is only emitted once.  */
-       tree cond
-         = build_conditional_expr (TREE_OPERAND (lhs, 0),
-                                   build_modify_expr (cp_convert (TREE_TYPE (lhs), TREE_OPERAND (lhs, 1)),
-                                                      modifycode, rhs),
-                                   build_modify_expr (cp_convert (TREE_TYPE (lhs), TREE_OPERAND (lhs, 2)),
-                                                      modifycode, rhs));
+       tree cond;
+
+       /* Check this here to avoid odd errors when trying to convert
+          a throw to the type of the COND_EXPR.  */
+       if (!lvalue_or_else (lhs, "assignment"))
+         return error_mark_node;
+
+       cond = build_conditional_expr
+         (TREE_OPERAND (lhs, 0),
+          build_modify_expr (cp_convert (TREE_TYPE (lhs),
+                                         TREE_OPERAND (lhs, 1)),
+                             modifycode, rhs),
+          build_modify_expr (cp_convert (TREE_TYPE (lhs),
+                                         TREE_OPERAND (lhs, 2)),
+                             modifycode, rhs));
+
        if (cond == error_mark_node)
          return cond;
        /* Make sure the code to compute the rhs comes out