pt.c (tsubst_copy): Deal with BIND_EXPR in a way that more closely mimics the behavio...
authorMark Mitchell <mmitchell@usa.net>
Mon, 16 Mar 1998 10:54:48 +0000 (10:54 +0000)
committerMark Mitchell <mmitchell@gcc.gnu.org>
Mon, 16 Mar 1998 10:54:48 +0000 (10:54 +0000)
* 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
gcc/cp/pt.c

index 9b47256..90e2a2b 100644 (file)
@@ -1,3 +1,10 @@
+Mon Mar 16 10:54:21 1998  Mark Mitchell  <mmitchell@usa.net>
+
+       * 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  <jason@yorick.cygnus.com>
 
        * cp-tree.h (TEMPLATE_PARMS_FOR_INLINE): New macro.
index 52a4254..f261edf 100644 (file)
@@ -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;