Title
Linkage of explicit specializations
Status
c++11
Section
13.9.4 [temp.expl.spec]
Submitter
Steve Clamage

Created on 2006-11-30.00:00:00 last changed 123 months ago

Messages

Date: 2010-08-15.00:00:00

[Voted into WP at August, 2010 meeting.]

Date: 2010-03-15.00:00:00

Proposed resolution (March, 2010):

Change Clause 13 [temp] paragraph 4 as follows:

...Entities generated from Specializations (explicit or implicit) of a template with that has internal linkage are distinct from all entities generated specializations in other translation units...
Date: 2007-04-15.00:00:00

Notes from the April, 2007 meeting:

The CWG agreed that the linkage of an explicit specialization must be that of the template. Gabriel Dos Reis will investigate the reason for the different behavior of g++.

Date: 2020-12-15.00:00:00

Given

    template <class T> static T f(T   t) { ... }
    template <>             int f(int t) { ... }

what is the linkage of f(int)?

Section Clause 13 [temp] paragraph 4 says,

Entities generated from a template with internal linkage are distinct from all entities generated in other translation units.

But is the explicit specialization “generated from” the primary template? Does it inherit the local linkage? If so, where do I find a reference saying so explicitly?

James Widman: Data points: EDG 3.8 inherits, GCC 4.0 does not.

Mike Miller: There's a pretty strong presumption that the linkage of an explicit specialization cannot be different from that of its primary template, given that storage class specifiers cannot appear in an explicit specialization (9.2.2 [dcl.stc] paragraph 1).

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetstatus: wp -> fdis
2010-11-29 00:00:00adminsetstatus: dr -> wp
2010-08-23 00:00:00adminsetmessages: + msg2929
2010-08-23 00:00:00adminsetstatus: ready -> dr
2010-03-29 00:00:00adminsetstatus: review -> ready
2010-02-16 00:00:00adminsetmessages: + msg2564
2010-02-16 00:00:00adminsetstatus: drafting -> review
2007-05-06 00:00:00adminsetmessages: + msg1490
2007-05-06 00:00:00adminsetstatus: open -> drafting
2006-11-30 00:00:00admincreate