diff options
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index ea985e4..43d74dc 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3039,7 +3039,12 @@ push_namespace_with_attribs (tree name, tree attributes) /* Make a new namespace, binding the name to it. */ d = build_lang_decl (NAMESPACE_DECL, name, void_type_node); DECL_CONTEXT (d) = FROB_CONTEXT (current_namespace); - TREE_PUBLIC (d) = 1; + /* The name of this namespace is not visible to other translation + units if it is an anonymous namespace or member thereof. */ + if (anon || decl_anon_ns_mem_p (current_namespace)) + TREE_PUBLIC (d) = 0; + else + TREE_PUBLIC (d) = 1; pushdecl (d); if (anon) { @@ -3086,15 +3091,6 @@ push_namespace_with_attribs (tree name, tree attributes) push_visibility (TREE_STRING_POINTER (x)); goto found; } -#if 0 - if (anon) - { - /* Anonymous namespaces default to hidden visibility. This might - change once we implement export. */ - current_binding_level->has_visibility = 1; - push_visibility ("hidden"); - } -#endif found: #endif @@ -4914,6 +4910,10 @@ pushtag (tree name, tree type, tag_scope scope) gcc_assert (TREE_CODE (decl) == TYPE_DECL); TYPE_STUB_DECL (type) = decl; + /* Set type visibility now if this is a forward declaration. */ + TREE_PUBLIC (decl) = 1; + determine_visibility (decl); + POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, type); } |