aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-09-11 21:45:59 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-09-11 21:45:59 -0700
commit0fe0caa6d942920ebaab6197c8bedb4e371e9110 (patch)
tree924d91327c967d75aa12673c2b98f330d7f41add /gcc/cp
parent97b7c168e52660bec48a39d59cdba87e8f330123 (diff)
downloadgcc-0fe0caa6d942920ebaab6197c8bedb4e371e9110.zip
gcc-0fe0caa6d942920ebaab6197c8bedb4e371e9110.tar.gz
gcc-0fe0caa6d942920ebaab6197c8bedb4e371e9110.tar.bz2
pt.c (cur_stmt_expr): Move from tsubst_expr.
* pt.c (cur_stmt_expr): Move from tsubst_expr. (tsubst_expr) <case STMT_EXPR>: Move ... (tsubst_copy_and_build): ... here. From-SVN: r87385
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c36
2 files changed, 25 insertions, 18 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8e1f434..c8ba24d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2004-09-11 Richard Henderson <rth@redhat.com>
+
+ PR c++/17404
+ * pt.c (cur_stmt_expr): Move from tsubst_expr.
+ (tsubst_expr) <case STMT_EXPR>: Move ...
+ (tsubst_copy_and_build): ... here.
+
2004-09-10 Zack Weinberg <zack@codesourcery.com>
* cp-tree.h (interface_only, interface_unknown): Delete declarations;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3bdcf06..0a6b773 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -67,6 +67,11 @@ static GTY(()) tree current_tinst_level;
static GTY(()) tree saved_access_scope;
+/* Live only within one (recursive) call to tsubst_expr. We use
+ this to pass the statement expression node from the STMT_EXPR
+ to the EXPR_STMT that is its result. */
+static tree cur_stmt_expr;
+
/* A map from local variable declarations in the body of the template
presently being instantiated to the corresponding instantiated
local variables. */
@@ -7790,11 +7795,6 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
static tree
tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
- /* Live only within one (recursive) call to tsubst_expr. We use
- this to pass the statement expression node from the STMT_EXPR
- to the EXPR_STMT that is its result. */
- static tree cur_stmt_expr;
-
tree stmt, tmp;
if (t == NULL_TREE || t == error_mark_node)
@@ -7825,19 +7825,6 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
args, complain, in_decl));
break;
- case STMT_EXPR:
- {
- tree old_stmt_expr = cur_stmt_expr;
- tree stmt_expr = begin_stmt_expr ();
-
- cur_stmt_expr = stmt_expr;
- tsubst_expr (STMT_EXPR_STMT (t), args, complain, in_decl);
- stmt_expr = finish_stmt_expr (stmt_expr, false);
- cur_stmt_expr = old_stmt_expr;
-
- return stmt_expr;
- }
-
case EXPR_STMT:
tmp = tsubst_expr (EXPR_STMT_EXPR (t), args, complain, in_decl);
if (EXPR_STMT_STMT_EXPR_RESULT (t))
@@ -8626,6 +8613,19 @@ tsubst_copy_and_build (tree t,
case OFFSETOF_EXPR:
return fold_offsetof (RECUR (TREE_OPERAND (t, 0)));
+ case STMT_EXPR:
+ {
+ tree old_stmt_expr = cur_stmt_expr;
+ tree stmt_expr = begin_stmt_expr ();
+
+ cur_stmt_expr = stmt_expr;
+ tsubst_expr (STMT_EXPR_STMT (t), args, complain, in_decl);
+ stmt_expr = finish_stmt_expr (stmt_expr, false);
+ cur_stmt_expr = old_stmt_expr;
+
+ return stmt_expr;
+ }
+
default:
return tsubst_copy (t, args, complain, in_decl);
}