aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-06-16 10:59:07 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-06-16 10:59:07 -0700
commit894ca2c9ff6321673af96c42b1028db992b98943 (patch)
treedd5662f9db85cb749d8b6177430ec74783e363cc /gcc/cp/semantics.c
parente751adc3b1b146663267485a2dcf1ebe239a5c3d (diff)
downloadgcc-894ca2c9ff6321673af96c42b1028db992b98943.zip
gcc-894ca2c9ff6321673af96c42b1028db992b98943.tar.gz
gcc-894ca2c9ff6321673af96c42b1028db992b98943.tar.bz2
re PR c++/16012 (trouble with scope in for statements in templates)
PR c++/16012 * semantics.c (begin_for_stmt, begin_for_stmt): Do put the init statement in FOR_INIT_STMT for templates. From-SVN: r83253
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index eeb66c5..ef82cb1 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -652,6 +652,9 @@ begin_for_stmt (void)
if (flag_new_for_scope > 0)
TREE_CHAIN (r) = do_pushlevel (sk_for);
+ if (processing_template_decl)
+ FOR_INIT_STMT (r) = push_stmt_list ();
+
return r;
}
@@ -661,6 +664,8 @@ begin_for_stmt (void)
void
finish_for_init_stmt (tree for_stmt)
{
+ if (processing_template_decl)
+ FOR_INIT_STMT (for_stmt) = pop_stmt_list (FOR_INIT_STMT (for_stmt));
add_stmt (for_stmt);
FOR_BODY (for_stmt) = do_pushlevel (sk_block);
FOR_COND (for_stmt) = push_stmt_list ();