aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-01-03 14:29:51 -0500
committerJason Merrill <jason@gcc.gnu.org>2003-01-03 14:29:51 -0500
commit6cce57b0d073bc545a9a2855885e65a4ca43ce4d (patch)
treeed397435e12ce43cd81067953111919e1628866f /gcc/cp/decl.c
parent9c91c80bb7595b799dc5c653de60f9c9d5898d14 (diff)
downloadgcc-6cce57b0d073bc545a9a2855885e65a4ca43ce4d.zip
gcc-6cce57b0d073bc545a9a2855885e65a4ca43ce4d.tar.gz
gcc-6cce57b0d073bc545a9a2855885e65a4ca43ce4d.tar.bz2
c-common.c (finish_fname_decls): Put the DECL_STMTs inside the outermost scope.
* c-common.c (finish_fname_decls): Put the DECL_STMTs inside the outermost scope. * c-decl.c (c_make_fname_decl): Push the decls there, too. cp/ * decl.c (cp_make_fname_decl): Push the decls inside the outermost scope. From-SVN: r60848
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index aaf4262..ed20009 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6656,7 +6656,7 @@ cp_make_fname_decl (id, type_dep)
tree init = cp_fname_init (name);
tree decl = build_decl (VAR_DECL, id, TREE_TYPE (init));
- /* As we don't push the decl here, we must set the context. */
+ /* As we're using pushdecl_with_scope, we must set the context. */
DECL_CONTEXT (decl) = current_function_decl;
DECL_PRETTY_FUNCTION_P (decl) = type_dep;
@@ -6667,6 +6667,14 @@ cp_make_fname_decl (id, type_dep)
TREE_USED (decl) = 1;
+ if (current_function_decl)
+ {
+ struct cp_binding_level *b = current_binding_level;
+ while (b->level_chain->parm_flag == 0)
+ b = b->level_chain;
+ pushdecl_with_scope (decl, b);
+ }
+
cp_finish_decl (decl, init, NULL_TREE, LOOKUP_ONLYCONVERTING);
return decl;