re PR c++/16851 (ICE when throwing a comma expression)
authorJason Merrill <jason@redhat.com>
Sat, 28 Aug 2004 02:35:15 +0000 (22:35 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 28 Aug 2004 02:35:15 +0000 (22:35 -0400)
        PR c++/16851
        * tree.c (stabilize_init): See through a COMPOUND_EXPR.

From-SVN: r86688

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

index f1cac07a80369d4ae3d028e79194597aa3d13e46..976d2e5759570691a72a0e4ba22ceac52b9715b5 100644 (file)
@@ -1,5 +1,8 @@
 2004-08-27  Jason Merrill  <jason@redhat.com>
 
+       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.
index 99334678a7c252ad44aa207742d485480f751189..ec5a749f53163f61572d37511ae87133af983452 100644 (file)
@@ -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 (file)
index 0000000..3751327
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/16851
+
+struct A { A(int); };
+
+void f()
+{
+ throw (3,A(t));
+}