]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/cp/except.c
except.c (expand_start_catch_block): Fix catching a reference to pointer.
[gcc.git] / gcc / cp / except.c
index ff7a45b94a36ea46960ca7fbedd9fbf9c2adfb5d..56b2a4175e656f55ee356402db4327e5bc8f2d07 100644 (file)
@@ -614,6 +614,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,
This page took 0.026944 seconds and 5 git commands to generate.