From bcac21a0c6b6e927a963a1f4403891e526aa40ff Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 27 Aug 2004 22:35:15 -0400 Subject: [PATCH] re PR c++/16851 (ICE when throwing a comma expression) PR c++/16851 * tree.c (stabilize_init): See through a COMPOUND_EXPR. From-SVN: r86688 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/tree.c | 2 ++ gcc/testsuite/g++.dg/eh/throw2.C | 8 ++++++++ 3 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/g++.dg/eh/throw2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f1cac07a803..976d2e57595 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2004-08-27 Jason Merrill + PR c++/16851 + * tree.c (stabilize_init): See through a COMPOUND_EXPR. + PR c++/13684 * decl.c (expand_static_init): Use thread-safety API. (register_dtor_fn): Return the call, don't expand it. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 99334678a7c..ec5a749f531 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2316,6 +2316,8 @@ stabilize_init (tree init, tree *initp) t = TREE_OPERAND (t, 1); if (TREE_CODE (t) == TARGET_EXPR) t = TARGET_EXPR_INITIAL (t); + if (TREE_CODE (t) == COMPOUND_EXPR) + t = expr_last (t); if (TREE_CODE (t) == CONSTRUCTOR && CONSTRUCTOR_ELTS (t) == NULL_TREE) { diff --git a/gcc/testsuite/g++.dg/eh/throw2.C b/gcc/testsuite/g++.dg/eh/throw2.C new file mode 100644 index 00000000000..37513275fa2 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/throw2.C @@ -0,0 +1,8 @@ +// PR c++/16851 + +struct A { A(int); }; + +void f() +{ + throw (3,A(t)); +} -- 2.30.2