re PR c++/15745 (exception specification incorrectly changes the type of the exception thrown)

PR c++/15745
        * except.c (prepare_eh_type): Use type_decays_to.

        * except.c (initialize_handler_parm): Use
        fold_build_cleanup_point_expr.

        PR c++/31411
        * except.c (initialize_handler_parm): Put a CLEANUP_POINT_EXPR inside
        the MUST_NOT_THROW_EXPR.

From-SVN: r128382
This commit is contained in:
Jason Merrill
2007-09-11 11:20:47 -04:00
committed by Jason Merrill
parent cb99eed436
commit 7569b5eaaa
2 changed files with 18 additions and 0 deletions

View File

@@ -1,3 +1,15 @@
2007-09-11 Jason Merrill <jason@redhat.com>
PR c++/15745
* except.c (prepare_eh_type): Use type_decays_to.
* except.c (initialize_handler_parm): Use
fold_build_cleanup_point_expr.
PR c++/31411
* except.c (initialize_handler_parm): Put a CLEANUP_POINT_EXPR inside
the MUST_NOT_THROW_EXPR.
2007-09-08 Jason Merrill <jason@redhat.com>
PR c++/33342

View File

@@ -115,6 +115,9 @@ prepare_eh_type (tree type)
/* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type);
/* Functions and arrays decay to pointers. */
type = type_decays_to (type);
return type;
}
@@ -388,6 +391,9 @@ initialize_handler_parm (tree decl, tree exp)
See also expand_default_init. */
init = ocp_convert (TREE_TYPE (decl), init,
CONV_IMPLICIT|CONV_FORCE_TEMP, 0);
/* Force cleanups now to avoid nesting problems with the
MUST_NOT_THROW_EXPR. */
init = fold_build_cleanup_point_expr (TREE_TYPE (init), init);
init = build1 (MUST_NOT_THROW_EXPR, TREE_TYPE (init), init);
}