* tree.c (lvalue_p_1): A NOP_EXPR can be an lvalue.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 May 1999 12:17:36 +0000 (12:17 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 May 1999 12:17:36 +0000 (12:17 +0000)
(build_cplus_new): Make sure that what we return is of the right type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27063 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/tree.c

index c4bb98b..801aeea 100644 (file)
@@ -1,3 +1,8 @@
+1999-05-20  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * tree.c (lvalue_p_1): A NOP_EXPR can be an lvalue.
+       (build_cplus_new): Make sure that what we return is of the right type.
+
 1999-05-20  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.h (make_ptrmem_cst): New function.
index 3f7e5ca..a305cb5 100644 (file)
@@ -71,6 +71,7 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues)
     case WITH_CLEANUP_EXPR:
     case REALPART_EXPR:
     case IMAGPART_EXPR:
+    case NOP_EXPR:
       return lvalue_p_1 (TREE_OPERAND (ref, 0),
                         treat_class_rvalues_as_lvalues);
 
@@ -193,7 +194,7 @@ build_cplus_new (type, init)
   tree rval;
 
   if (TREE_CODE (init) != CALL_EXPR && TREE_CODE (init) != AGGR_INIT_EXPR)
-    return init;
+    return convert (type, init);
 
   slot = build (VAR_DECL, type);
   DECL_ARTIFICIAL (slot) = 1;