]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtti.c (build_dynamic_cast): Handle template case here.
authorJason Merrill <jason@yorick.cygnus.com>
Thu, 27 Nov 1997 06:47:05 +0000 (06:47 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 27 Nov 1997 06:47:05 +0000 (23:47 -0700)
        * rtti.c (build_dynamic_cast): Handle template case here.
        (build_dynamic_cast_1): Not here.

        * typeck2.c (digest_init): Make copies where appropriate.

        * decl2.c (delete_sanity): resolve_offset_ref.

        * except.c (expand_throw): Call mark_used on the destructor.

From-SVN: r16777

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/cp/except.c
gcc/cp/rtti.c
gcc/cp/typeck2.c

index b376f2782bb20d3ff9d9d88032ef1f1cfefe0a80..c80089251a922fde7b9636b29fbc307c5fc7162b 100644 (file)
@@ -5,8 +5,18 @@
 
 Wed Nov 26 20:28:49 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * rtti.c (build_dynamic_cast): Handle template case here.
+       (build_dynamic_cast_1): Not here.
+
+       * typeck2.c (digest_init): Make copies where appropriate.
+
+       * decl2.c (delete_sanity): resolve_offset_ref.
+
        * except.c (expand_throw): Call mark_used on the destructor.
 
+       * except.c (expand_start_catch_block): Fix catching a reference
+       to pointer.
+
 Tue Nov 25 11:28:21 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
        * init.c (build_new): Copy size to the saveable obstack.
index 5716af214d1efd3aa424f6e2bd3ca4509378e98c..4513f75df56e13c6273d9745a3ef04e534647a6c 100644 (file)
@@ -1242,7 +1242,10 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
       return t;
     }
 
-  t = stabilize_reference (convert_from_reference (exp));
+  t = exp;
+  if (TREE_CODE (t) == OFFSET_REF)
+    t = resolve_offset_ref (t);
+  t = stabilize_reference (convert_from_reference (t));
   type = TREE_TYPE (t);
   code = TREE_CODE (type);
 
index a18b70a6767fd71a368bdcbf52ec2dc98e9f61f8..91b1cdea7c6eb4aa343ea470d98bb6440fa278bf 100644 (file)
@@ -613,6 +613,13 @@ expand_start_catch_block (declspecs, declarator)
        init_type = build_reference_type (init_type);
 
       exp = get_eh_value ();
+
+      /* Since pointers are passed by value, initialize a reference to
+        pointer catch parm with the address of the value slot.  */
+      if (TREE_CODE (init_type) == REFERENCE_TYPE
+         && TREE_CODE (TREE_TYPE (init_type)) == POINTER_TYPE)
+       exp = build_unary_op (ADDR_EXPR, exp, 1);
+
       exp = expr_tree_cons (NULL_TREE,
                       build_eh_type_type (TREE_TYPE (decl)),
                       expr_tree_cons (NULL_TREE,
index e7b83d37726a39a1a5c8160d79c1db988c2afc4e..4940696272292288acdd0e14c45aa8e18a8494f9 100644 (file)
@@ -428,15 +428,6 @@ build_dynamic_cast_1 (type, expr)
   enum tree_code ec;
   tree dcast_fn;
 
-  if (type == error_mark_node || expr == error_mark_node)
-    return error_mark_node;
-  
-  if (processing_template_decl)
-    {
-      tree t = build_min (DYNAMIC_CAST_EXPR, type, expr);
-      return t;
-    }
-
   assert (exprtype != NULL_TREE);
   ec = TREE_CODE (exprtype);
 
@@ -647,6 +638,12 @@ tree
 build_dynamic_cast (type, expr)
      tree type, expr;
 {
+  if (type == error_mark_node || expr == error_mark_node)
+    return error_mark_node;
+  
+  if (processing_template_decl)
+    return build_min (DYNAMIC_CAST_EXPR, type, expr);
+
   return convert_from_reference (build_dynamic_cast_1 (type, expr));
 }
 \f
index d876e76806f66cc2562fd46535f77a9e18a1ddc5..24e3c5cf08b619465ab4b605471c60f423b8df8b 100644 (file)
@@ -743,6 +743,9 @@ digest_init (type, init, tail)
        init = DECL_INITIAL (init);
       else if (TREE_READONLY_DECL_P (init))
        init = decl_constant_value (init);
+      else if (IS_AGGR_TYPE (type) && TYPE_NEEDS_CONSTRUCTING (type))
+       init = ocp_convert (type, init, CONV_IMPLICIT|CONV_FORCE_TEMP,
+                           LOOKUP_NORMAL);
       return init;
     }