Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly misleading sentence in [temp.spec]/5 #1860

Closed
cpplearner opened this issue Nov 29, 2017 · 2 comments
Closed

Possibly misleading sentence in [temp.spec]/5 #1860

cpplearner opened this issue Nov 29, 2017 · 2 comments
Assignees

Comments

@cpplearner
Copy link
Contributor

cpplearner commented Nov 29, 2017

[temp.spec]/5:

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.

@jensmaurer
Copy link
Member

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.

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Nov 29, 2017
@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Mar 16, 2018
@zygoloid
Copy link
Member

zygoloid commented Mar 16, 2018

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].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants