https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118513

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/cp/decl2.cc.jj  2025-01-16 13:34:29.719360710 +0100
+++ gcc/cp/decl2.cc     2025-01-16 14:27:54.095464791 +0100
@@ -3656,6 +3656,8 @@ copy_linkage (tree guard, tree decl)
        comdat_linkage (guard);
       DECL_VISIBILITY (guard) = DECL_VISIBILITY (decl);
       DECL_VISIBILITY_SPECIFIED (guard) = DECL_VISIBILITY_SPECIFIED (decl);
+      if (expr_visibility (decl) == VISIBILITY_ANON)
+       constrain_visibility (guard, VISIBILITY_ANON, false); 
     }
 }

fixes it, but then if decl has VISIBILITY_ANON, it should already be
!TREE_PUBLIC, so shouldn't that be if (!TREE_PUBLIC (decl))
constrain_visibility (guard, VISIBILITY_ANON, false); or even
if (!TREE_PUBLIC (decl) && DECL_INTERFACE_KNOWN (decl)) { DECL_INTERFACE_KNOWN
(guard) = 1; if (DECL_LANG_SPECIFIC (decl)) DECL_NOT_REALLY_EXTERN (decl) = 1;
}
?

Reply via email to