Title
Linkage of const-qualified variable template
Status
cd5
Section
6.6 [basic.link]
Submitter
John Spicer

Created on 2018-09-28.00:00:00 last changed 48 months ago

Messages

Date: 2019-02-15.00:00:00

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]

Date: 2018-12-15.00:00:00

Notes from the December, 2018 teleconference:

CWG felt that a const type should not affect the linkage of a variable template or its instances.

Date: 2019-02-15.00:00:00

[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?

History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6361
2020-12-15 00:00:00adminsetmessages: + msg6360
2018-09-28 00:00:00admincreate