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

[basic.def.odr] What does D refer to in p14? #4498

Closed
cpplearner opened this issue Feb 17, 2021 · 6 comments · Fixed by #6272
Closed

[basic.def.odr] What does D refer to in p14? #4498

cpplearner opened this issue Feb 17, 2021 · 6 comments · Fixed by #6272
Labels
decision-required A decision of the editorial group (or the Project Editor) is required.

Comments

@cpplearner
Copy link
Contributor

[basic.def.odr]/14:

If D is a template and is defined in more than one translation unit, then the preceding requirements shall apply both to names from the template's enclosing scope used in the template definition, and also to dependent names at the point of instantiation ([temp.dep]). These requirements also apply to corresponding entities defined within each definition of D (including the closure types of lambda-expressions, but excluding entities defined within default arguments or default template arguments of either D or an entity not defined within D). For each such entity and for D itself, the behavior is as if there is a single entity with a single definition, including in the application of these requirements to other entities.

It's clear that in the first sentence, D must be a template. But do the second and third sentences (starting from "These requirements") apply when D is not a template?

@jensmaurer
Copy link
Member

jensmaurer commented Feb 17, 2021

Yes. "D" is defined way above and not limited to templates.

@languagelawyer
Copy link
Contributor

Then it is unclear why it was moved to its own paragraph instead of becoming another list item:

  • If D is a class with an implicitly-declared constructor...
  • If D is a class with a defaulted three-way comparison operator function...
  • If D is a template and is defined in more than one translation unit...

@jensmaurer
Copy link
Member

The commit you referenced didn't move the "If D is a template" outside of the bullets.

Historically, maybe it was felt that references to "these requirements" (meaning the bulleted list) should be outside of the bulleted list. We're already inconsistent with the use of default arguments, though, so moving at least the "If template" part into the bullets (and maybe some of the other stuff) would clarify.

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label May 2, 2021
@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 19, 2021

@zygoloid: This is subtle, would you perhaps have a suggestion?

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 12, 2023

Suggestion: merge p15 into the previous paragraph as a bullet, but check with @zygoloid. But should the recursion ("these requirements") be part of the bullets, separate bullets, or in a separate paragraph?

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 13, 2023

Proposal from @zygoloid in #6272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision-required A decision of the editorial group (or the Project Editor) is required.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants