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


2387. Linkage of const-qualified variable template

Section: 6.6  [basic.link]     Status: CD5     Submitter: John Spicer     Date: 2018-09-28

[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

[Note: An instantiated variable template that has const-qualified type can have external linkage, even if not declared extern. —end note]