aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5a630f5..49d1920 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1857,6 +1857,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
SET_DECL_TEMPLATE_SPECIALIZATION (olddecl);
+ /* Don't propagate visibility from the template to the
+ specialization here. We'll do that in determine_visibility if
+ appropriate. */
+ DECL_VISIBILITY_SPECIFIED (olddecl) = 0;
+
/* [temp.expl.spec/14] We don't inline explicit specialization
just because the primary template says so. */
}
@@ -3119,6 +3124,7 @@ cxx_init_decl_processing (void)
gcc_assert (global_namespace == NULL_TREE);
global_namespace = build_lang_decl (NAMESPACE_DECL, global_scope_name,
void_type_node);
+ TREE_PUBLIC (global_namespace) = 1;
begin_scope (sk_namespace, global_namespace);
current_lang_name = NULL_TREE;
@@ -5240,6 +5246,9 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
else
abstract_virtuals_error (decl, type);
+ /* This needs to happen after the linkage is set. */
+ determine_visibility (decl);
+
if (TREE_CODE (decl) == FUNCTION_DECL
|| TREE_TYPE (decl) == error_mark_node)
/* No initialization required. */
@@ -5263,10 +5272,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
initialize_local_var (decl, init);
}
- /* The variable is being defined, so determine its visibility.
- This needs to happen after the linkage is set. */
- determine_visibility (decl);
-
/* If a variable is defined, and then a subsequent
definition with external linkage is encountered, we will
get here twice for the same variable. We want to avoid