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

[namespace.def.general] Clarify inline namespaces #4562

Merged
merged 1 commit into from May 29, 2021

Conversation

jensmaurer
Copy link
Member

Highlight 'innermost enclosing' namespace, and remove
unneeded mechanism of inserting a using-directive.

Fixes #4556

@tkoeppe
Copy link
Contributor

tkoeppe commented Apr 30, 2021

@opensdh: could you kindly review this?

@opensdh
Copy link
Contributor

opensdh commented Apr 30, 2021

The discussion on the issue mostly focused on the "enclosing" phrasing. Isn't the using-directive necessary for unqualified lookup? [namespace.qual]/1 says that qualified lookup "additionally searches every element of the inline namespace set", but unqualified lookup has only the directives ([basic.lookup.unqual]/2.2).

@tkoeppe
Copy link
Contributor

tkoeppe commented May 29, 2021

@jensmaurer: any thoughts?

@jensmaurer
Copy link
Member Author

@opensdh, you're right. I'll reduce this pull request to just talk about "innermost enclosing" then, and leave the using-directive alone.

Do you feel we could/should add an explicit bullet to basic.lookup.unqual that talks about looking in the inline namespace set? That feels a lot more straightforward than introducing a hypothetical using-directive.

Highlight 'innermost enclosing' namespace.
@jensmaurer
Copy link
Member Author

@tkoeppe, this should be pretty straightforward now.

@tkoeppe tkoeppe merged commit 890b339 into cplusplus:master May 29, 2021
@tkoeppe
Copy link
Contributor

tkoeppe commented May 29, 2021

Thanks, that's indeed straight-forward. @opensdh: what do you think about following up as Jens suggests?

@jensmaurer jensmaurer deleted the c5 branch May 30, 2021 18:33
@opensdh
Copy link
Contributor

opensdh commented Jun 1, 2021

Since using-directives are transitive, you would have to add not a bullet to [basic.lookup.unqual]/2 but a rule after those bullets that for every namespace's scope explicitly searched in them, a search is also performed in every member of its inline namespace set. I don't know whether that's nicer than the current formulation.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 1, 2021

@opensdh: Thanks! I find it hard to tell. @jensmaurer, feel free to propose something if you think the exposition could be made easier to follow here, and we can see if it's worth it. But it sounds like the status quo isn't all that bad, either.

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

Successfully merging this pull request may close these issues.

[namespace.def.general] p6 Clarify "enclosing" and inserted using-directive
3 participants