It seems more interesting than at first glance.

Anyway, after carefully looking at the standard and getting wrong but useful answers from AI models, I believe the behaviour is implied in [temp.spec.general]:

1 The act of instantiating a function, a variable, a class, a member of a class template, or a member template is referred to as template instantiation.
2 A function instantiated from a function template is called an instantiated function…
4 A specialization is a class, variable, function, or class member that is either instantiated from a templated entity or is an explicit specialization of a templated entity.

So a specialization of a function template is a normal function, and normal rules then apply [basic.link]: unless the entity falls into the categories specified as having internal linkage, "the name has external linkage".

On Thu, 12 Sept 2024 at 22:52, Sean Mayard via Std-Discussion <std-discussion@lists.isocpp.org> wrote:
Hi, I am trying to find out if explicit specialization of function templates or class templates have the same linkage as the primary template. Or is it that explicit specialization has no linkage at all?

I tried find it in the standard but couldn't find it. I probably have missed something so I would be glad if someone can help me for the same. Or maybe a cwg issue is needed(If i didn't miss anything)?

Regards,
--
Std-Discussion mailing list
Std-Discussion@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion


--
Yongwei Wu
URL: http://wyw.dcweb.cn/