]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/31411 (ICE in gimplify_expr with throw/special copy constructor with initia...
authorJason Merrill <jason@redhat.com>
Tue, 4 Sep 2007 18:37:33 +0000 (14:37 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 4 Sep 2007 18:37:33 +0000 (14:37 -0400)
        PR c++/31411
        * except.c (initialize_handler_parm): Put a CLEANUP_POINT_EXPR inside
        the MUST_NOT_THROW_EXPR.

From-SVN: r128100

gcc/cp/ChangeLog
gcc/cp/except.c
gcc/testsuite/g++.dg/eh/catch5.C [new file with mode: 0644]

index 63b7b207ef12b1ca61efc0602120b742196a03e1..e517f89d11278189d7acde5c4d9eea7406e7fa3e 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-04  Jason Merrill  <jason@redhat.com>
+
+       PR c++/31411
+       * except.c (initialize_handler_parm): Put a CLEANUP_POINT_EXPR inside
+       the MUST_NOT_THROW_EXPR.
+
 2007-09-04  Richard Sandiford  <richard@codesourcery.com>
 
        * decl.c (cp_finish_decl): Call determine_visibility before
index b6e8eeac710169f566c2df96ef73ab8bd26fc57a..3217f27c0d5d495d5a3cd90f683c8606cda24cc4 100644 (file)
@@ -388,6 +388,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 = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (init), init);
       init = build1 (MUST_NOT_THROW_EXPR, TREE_TYPE (init), init);
     }
 
diff --git a/gcc/testsuite/g++.dg/eh/catch5.C b/gcc/testsuite/g++.dg/eh/catch5.C
new file mode 100644 (file)
index 0000000..6001b56
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/31411
+
+struct allocator{
+  ~allocator() throw();
+};
+struct string
+{
+  string(const string& str, const allocator& al = allocator());
+};
+int main() {
+  try {}
+  catch (string smess) {}
+}