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.link]/10 definition of "attached to module" is redunant and circular #5082

Closed
RedBeard0531 opened this issue Oct 29, 2021 · 3 comments

Comments

@RedBeard0531
Copy link
Contributor

https://eel.is/c++draft/basic.link#10

If two declarations of an entity are attached to different modules, the program is ill-formed; no diagnostic is required if neither is reachable from the other. [...] As a consequence of these rules, all declarations of an entity are attached to the same module; the entity is said to be attached to that module.

That basically seems to be saying that an entity is said to be attached to a module if it is attached to that module...

We have another definition of attachment at https://eel.is/c++draft/module.unit#7, so maybe it would be best to remove the part of [basic.link]/10 after the semicolon. If the definition in [basic.link] is trying to expand the concept from a declaration to an entity, and we think that distinction is important, it seems clearer to me to expand the wording in [module.unit] to say something like an entity is attached to whichever module the declaration that declares it is attached to.

@jensmaurer
Copy link
Member

@opensdh, any insight here?

@opensdh
Copy link
Contributor

opensdh commented Oct 29, 2021

It is indeed the purpose of this paragraph to extend the attachment property from declarations to entities. That property is used in a number of places like [basic.def.odr]/15, [basic.lookup.argdep]/4.3, [basic.start.main]/3, and [dcl.inline]/7, so we probably do want to retain it. Since the rest of [basic.link] doesn't need the notion of attachment (not even for the TU-local rules), we could indeed move the definition, but we'd have to bring in the constraint as well as the definition in order for the definition to be meaningful. I don't have a strong opinion here.

@jensmaurer
Copy link
Member

@RedBeard0531 , we have "declaration attached to a module" in [module.unit] p7 and we have "entity attached to a module" in [basic.link] p10. Those are different things, nothing circular here.

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