diff options
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 10 |
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; |