Comments
Patch
commit d4880772f234b9c86b0af79954ea88f2134fbaa4
Author: Jason Merrill <jason@redhat.com>
Date: Fri Sep 16 16:14:59 2011 -0400
PR c++/50424
* tree.c (bot_manip): Set cp_function_chain->can_throw.
@@ -1861,7 +1861,11 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
}
/* Make a copy of this node. */
- return copy_tree_r (tp, walk_subtrees, NULL);
+ t = copy_tree_r (tp, walk_subtrees, NULL);
+ if (TREE_CODE (*tp) == CALL_EXPR && !TREE_NOTHROW (*tp)
+ && cfun && cp_function_chain)
+ cp_function_chain->can_throw = 1;
+ return t;
}
/* Replace all remapped VAR_DECLs in T with their new equivalents.
new file mode 100644
@@ -0,0 +1,10 @@
+// PR c++/50424
+// { dg-do run }
+
+int f() { throw 1; }
+void g( int = f() ) { }
+void h() { g(); }
+int main()
+{
+ try { h(); } catch (int) { }
+}