From 544c188d00e2d25b484394bea9a6d28ab271d9a0 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 16 Mar 1998 10:54:48 +0000 Subject: [PATCH] pt.c (tsubst_copy): Deal with BIND_EXPR in a way that more closely mimics the behavior in parse.y. * pt.c (tsubst_copy): Deal with BIND_EXPR in a way that more closely mimics the behavior in parse.y. (tsubst_expr): Return the resuting BLOCK when making a tsubst'ing into a compound statement. From-SVN: r18618 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/pt.c | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9b47256da9c..90e2a2b6b7b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +Mon Mar 16 10:54:21 1998 Mark Mitchell + + * pt.c (tsubst_copy): Deal with BIND_EXPR in a way that more + closely mimics the behavior in parse.y. + (tsubst_expr): Return the resuting BLOCK when making a tsubst'ing + into a compound statement. + Sun Mar 15 02:07:26 1998 Jason Merrill * cp-tree.h (TEMPLATE_PARMS_FOR_INLINE): New macro. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 52a42545763..f261edfa1e4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4553,11 +4553,12 @@ tsubst_copy (t, args, in_decl) build_expr_from_tree. So, we need to expand the BIND_EXPR here. */ tree rtl_exp = expand_start_stmt_expr(); - tsubst_expr (TREE_OPERAND (r, 1), args, in_decl); + tree block = tsubst_expr (TREE_OPERAND (r, 1), args, in_decl); rtl_exp = expand_end_stmt_expr (rtl_exp); TREE_SIDE_EFFECTS (rtl_exp) = 1; - return build (BIND_EXPR, TREE_TYPE (rtl_exp), - NULL_TREE, rtl_exp, TREE_OPERAND (r, 2)); + r = build (BIND_EXPR, TREE_TYPE (rtl_exp), + NULL_TREE, rtl_exp, block); + delete_block (block); } return r; @@ -4841,7 +4842,7 @@ tsubst_expr (t, args, in_decl) tsubst_expr (substmt, args, in_decl); if (COMPOUND_STMT_NO_SCOPE (t) == 0) - do_poplevel (); + return do_poplevel (); } break; -- 2.30.2