aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2024-09-04 02:42:58 +1000
committerNathaniel Shead <nathanieloshead@gmail.com>2024-09-27 13:49:23 +1000
commitad08ef098a8c8bb9c148d0a32e91456fdf58ffc1 (patch)
treee5b211b5bcdbbbe62c9ed9969fc02896d8c53022 /gcc/cp
parentaf4471cb422a867f1877c7c08bb63fa75a8888fe (diff)
downloadgcc-ad08ef098a8c8bb9c148d0a32e91456fdf58ffc1.zip
gcc-ad08ef098a8c8bb9c148d0a32e91456fdf58ffc1.tar.gz
gcc-ad08ef098a8c8bb9c148d0a32e91456fdf58ffc1.tar.bz2
c++/modules: Use decl_linkage in maybe_record_mergeable_decl
This avoids any possible inconsistencies (current or future) about whether a declaration is internal or not. gcc/cp/ChangeLog: * name-lookup.cc (maybe_record_mergeable_decl): Use decl_linkage instead of ad-hoc checks. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/name-lookup.cc9
1 files changed, 1 insertions, 8 deletions
diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc
index 50e169e..c0f89f9 100644
--- a/gcc/cp/name-lookup.cc
+++ b/gcc/cp/name-lookup.cc
@@ -3725,17 +3725,10 @@ maybe_record_mergeable_decl (tree *slot, tree name, tree decl)
if (TREE_CODE (*slot) != BINDING_VECTOR)
return;
- if (!TREE_PUBLIC (CP_DECL_CONTEXT (decl)))
- /* Member of internal namespace. */
+ if (decl_linkage (decl) == lk_internal)
return;
tree not_tmpl = STRIP_TEMPLATE (decl);
- if ((TREE_CODE (not_tmpl) == FUNCTION_DECL
- || VAR_P (not_tmpl))
- && DECL_THIS_STATIC (not_tmpl))
- /* Internal linkage. */
- return;
-
bool is_attached = (DECL_LANG_SPECIFIC (not_tmpl)
&& DECL_MODULE_ATTACH_P (not_tmpl));
tree *gslot = get_fixed_binding_slot