diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/name-lookup.c | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 8cd6fe3..6204444 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -7404,6 +7404,8 @@ pushdecl_top_level (tree x) { bool subtime = timevar_cond_start (TV_NAME_LOOKUP); do_push_to_top_level (); + gcc_checking_assert (!DECL_CONTEXT (x)); + DECL_CONTEXT (x) = FROB_CONTEXT (global_namespace); x = pushdecl_namespace_level (x); do_pop_from_top_level (); timevar_cond_stop (TV_NAME_LOOKUP, subtime); @@ -7418,6 +7420,8 @@ pushdecl_top_level_and_finish (tree x, tree init) { bool subtime = timevar_cond_start (TV_NAME_LOOKUP); do_push_to_top_level (); + gcc_checking_assert (!DECL_CONTEXT (x)); + DECL_CONTEXT (x) = FROB_CONTEXT (global_namespace); x = pushdecl_namespace_level (x); cp_finish_decl (x, init, false, NULL_TREE, 0); do_pop_from_top_level (); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 869477f..45b18f6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7094,12 +7094,12 @@ get_template_parm_object (tree expr, tsubst_flags_t complain) tree type = cp_build_qualified_type (TREE_TYPE (expr), TYPE_QUAL_CONST); decl = create_temporary_var (type); + DECL_CONTEXT (decl) = NULL_TREE; TREE_STATIC (decl) = true; DECL_DECLARED_CONSTEXPR_P (decl) = true; TREE_READONLY (decl) = true; DECL_NAME (decl) = name; SET_DECL_ASSEMBLER_NAME (decl, name); - DECL_CONTEXT (decl) = global_namespace; comdat_linkage (decl); if (!zero_init_p (type)) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b093044..1e42cd7 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3030,6 +3030,7 @@ finish_compound_literal (tree type, tree compound_literal, && initializer_constant_valid_p (compound_literal, type)) { tree decl = create_temporary_var (type); + DECL_CONTEXT (decl) = NULL_TREE; DECL_INITIAL (decl) = compound_literal; TREE_STATIC (decl) = 1; if (literal_type_p (type) && CP_TYPE_CONST_NON_VOLATILE_P (type)) |