re PR c++/16112 (ICE with statement expression in return statement)
authorJason Merrill <jason@redhat.com>
Tue, 22 Jun 2004 21:15:29 +0000 (17:15 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 22 Jun 2004 21:15:29 +0000 (17:15 -0400)
        PR c++/16112
        * cp-gimplify.c (cp_gimplify_init_expr): Look through
        CLEANUP_POINT_EXPR.

From-SVN: r83514

gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/testsuite/g++.dg/ext/stmtexpr3.C [new file with mode: 0644]

index 05ddba31d7b2471eb7bd2ee23a5bec567dd009ae..7838ab8d56b8b0eca5f42d368450dbd2eb93bcd7 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-21  Jason Merrill  <jason@redhat.com>
+
+       * cp-gimplify.c (cp_gimplify_init_expr): Look throug
+
 2004-06-21  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.def (NEW_EXPR): Add a fourth slot.
index f9b236472a89d2cee44e32b6b3164fc3f7ff0bec..db88e052b4df79c2de1536fdaa237002fe483e93 100644 (file)
@@ -116,6 +116,8 @@ cp_gimplify_init_expr (tree *expr_p, tree *pre_p, tree *post_p)
      case, I guess we'll need to replace references somehow.  */
   if (TREE_CODE (from) == TARGET_EXPR)
     from = TARGET_EXPR_INITIAL (from);
+  if (TREE_CODE (from) == CLEANUP_POINT_EXPR)
+    from = TREE_OPERAND (from, 0);
 
   /* Look through any COMPOUND_EXPRs.  */
   sub = expr_last (from);
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr3.C b/gcc/testsuite/g++.dg/ext/stmtexpr3.C
new file mode 100644 (file)
index 0000000..9a3205c
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/16112
+// { dg-options "" }
+
+struct A
+{
+    A();
+};
+
+A foo() { return ({ A(); }); }