From 28c6dc635956b00d497d8d12cd95b61c47ebb2b8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 22 Jun 2004 17:15:29 -0400 Subject: [PATCH] re PR c++/16112 (ICE with statement expression in return statement) PR c++/16112 * cp-gimplify.c (cp_gimplify_init_expr): Look through CLEANUP_POINT_EXPR. From-SVN: r83514 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/cp-gimplify.c | 2 ++ gcc/testsuite/g++.dg/ext/stmtexpr3.C | 9 +++++++++ 3 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/stmtexpr3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 05ddba31d7b..7838ab8d56b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2004-06-21 Jason Merrill + + * cp-gimplify.c (cp_gimplify_init_expr): Look throug + 2004-06-21 Mark Mitchell * cp-tree.def (NEW_EXPR): Add a fourth slot. diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index f9b236472a8..db88e052b4d 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -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 index 00000000000..9a3205c080a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/stmtexpr3.C @@ -0,0 +1,9 @@ +// PR c++/16112 +// { dg-options "" } + +struct A +{ + A(); +}; + +A foo() { return ({ A(); }); } -- 2.30.2