This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Accepted as a DR at the February, 2019 meeting.]
The list in 6.6 [basic.link] paragraph 3 specifying which entities receive internal linkage does not mention variable templates, so presumably a variable template has external linkage. Clause 13 [temp] paragraph 6 gives the impression that a specialization of a template with external linkage also has external linkage. However, current implementations appear to give internal linkage to specializations of const-qualified variable templates. Should const-qualified variable templates have internal linkage?
Notes from the December, 2018 teleconference:
CWG felt that a const type should not affect the linkage of a variable template or its instances.
Proposed resolution (February, 2019):
Change 6.6 [basic.link] paragraph 3 as follows:
A name having namespace scope (6.4.6 [basic.scope.namespace]) has internal linkage if it is the name of
a variable, variable template, function or function template that is explicitly declared static; or,
a non-inline non-template variable of non-volatile const-qualified type that is neither explicitly declared extern nor previously declared to have external linkage; or
a data member of an anonymous union.
[Note: An instantiated variable template that has const-qualified type can have external linkage, even if not declared extern. —end note]