Skip to content

[basic.lookup.unqual] Add an example for 2.2 with using-directives - #9372

Open
Endilll wants to merge 1 commit into
cplusplus:mainfrom
Endilll:using-directive-example
Open

Endilll wants to merge 1 commit into
cplusplus:mainfrom
Endilll:using-directive-example

Conversation

@Endilll

@Endilll Endilll commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

[basic.lookup.unqual]/2 reads:

An unqualified search in a scope S from a program point P includes the results of searches from P in
— (2.1) S, and
— (2.2) for any scope U that contains P and is or is contained by S, each namespace contained by S that is nominated by a using-directive that is active in U at P.
If no declarations are found, the results of the unqualified search are the results of an unqualified search in the parent scope of S, if any, from P.

It always takes me a while to understand 2.2 every time I see it, because it's denser than the surrounding text, and also the mechanics it describes is not the most intuitive. This PR adds an example for 2.2 and the sentence that follows for the benefit of the readers. All four implementations agree: https://godbolt.org/z/KE3oM3eET

@eisenwave eisenwave added the P3-Other Triaged issue not in P1 or P2 label Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3-Other Triaged issue not in P1 or P2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants