You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a given template and a given set of template-arguments,
[...]
an explicit specialization shall be defined at most once in a program (according to [basic.def.odr]),
[...]
I think it intends to say that an explicit specialization follows the requirements and exceptions (no pun intended) of the one-definition rule. In particular, specializations that define classes/inline functions/inline variables need to be present in every translation units that uses them. (Otherwise I cannot imagine how std::char_traits<char> or std::future<void> can be implemented.) But the wording does not make that clear.
The text was updated successfully, but these errors were encountered:
Your concern "specializations that define classes/inline functions/inline variables need to be present in every translation units that uses them" is addressed by [temp.expl.spec] p6, I believe.
I have a feeling there is room for a bit of consolidation with [basic.def.odr], because an explicit specialization definition actually defines a class/function/variable (in the sense of the ODR), so some of what we say here is already said by the ODR. Having said that, this is all subtle enough I'm not sure we can make much progress here on the editorial level, without CWG input.
Let's change "(according to [basic.def.odr])" -> ", as specified in [basic.def.odr]".
But I believe the wording is correct here: in your classes/inline functions/inline variables cases, there is only one definition according to [basic.def.odr].
[temp.spec]/5:
I think it intends to say that an explicit specialization follows the requirements and exceptions (no pun intended) of the one-definition rule. In particular, specializations that define classes/inline functions/inline variables need to be present in every translation units that uses them. (Otherwise I cannot imagine how
std::char_traits<char>
orstd::future<void>
can be implemented.) But the wording does not make that clear.The text was updated successfully, but these errors were encountered: