aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-objcp-common.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-07-28 08:57:36 -0700
committerNathan Sidwell <nathan@acm.org>2020-07-28 09:01:32 -0700
commitf3665bd1111c1799c0421490b5e655f977570354 (patch)
tree57a656ea045c750c559b5af198cc0301b2275ad4 /gcc/cp/cp-objcp-common.c
parent0cd58a9f091b39c5e41b7954d6c4bd88f3567d49 (diff)
downloadgcc-f3665bd1111c1799c0421490b5e655f977570354.zip
gcc-f3665bd1111c1799c0421490b5e655f977570354.tar.gz
gcc-f3665bd1111c1799c0421490b5e655f977570354.tar.bz2
c++: Set more DECL_CONTEXTs
I discovered we were not setting DECL_CONTEXT in a few cases, and grokfndecl's control flow wasn't making it clear that we were doing it in all cases. gcc/cp/ * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context. * cp-objcp-common.c (cp_pushdecl): Set decl's context. * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
Diffstat (limited to 'gcc/cp/cp-objcp-common.c')
-rw-r--r--gcc/cp/cp-objcp-common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index dfd8be9..fecf866 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -332,11 +332,12 @@ cp_get_global_decls ()
return NAMESPACE_LEVEL (global_namespace)->names;
}
-/* Push DECL into the current scope. */
+/* Push DECL into the current (namespace) scope. */
tree
cp_pushdecl (tree decl)
{
+ DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
return pushdecl (decl);
}