https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70413
--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- This gets wrongly set here: decl2.c: 2912 else if (DECL_TEMPLOID_INSTANTIATION (decl)) 2913 { 2914 /* DECL is an implicit instantiation of a function or static 2915 data member. */ 2916 if ((flag_implicit_templates 2917 && !flag_use_repository) 2918 || (flag_implicit_inline_templates 2919 && TREE_CODE (decl) == FUNCTION_DECL 2920 && DECL_DECLARED_INLINE_P (decl))) 2921 comdat_p = true; 2922 else But for instantiations with types defined in anon namespace this is wrong and "TREE_PUBLIC (decl) = 0" should be used instead.