From: Jason Merrill Date: Tue, 11 Sep 2007 15:20:47 +0000 (-0400) Subject: re PR c++/15745 (exception specification incorrectly changes the type of the exceptio... X-Git-Tag: releases/gcc-4.2.2~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7569b5eaaa3450afc2d5464f6b49f75406042fc1;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4800e52f7f42..897e9e3e705b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2007-09-11 Jason Merrill + + 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 PR c++/33342 diff --git a/gcc/cp/except.c b/gcc/cp/except.c index eb9bad99a3a2..a24098d7d6bf 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -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); }