Date: Sun, 30 Nov 2025 23:15:17 +0200
On Sun, 30 Nov 2025 at 22:28, Jens Maurer <jens.maurer_at_[hidden]> wrote:
>
>
>
> On 11/30/25 15:43, Ville Voutilainen wrote:
> > On Sun, 30 Nov 2025 at 00:42, Jens Maurer via Std-Discussion
> > <std-discussion_at_[hidden]> wrote:
> >>
> >>
> >>
> >> On 11/29/25 15:04, Russell Shaw via Std-Discussion wrote:
> >>> Hi,
> >>>
> >>> In [basic.lookup.unqual]:
> >>>
> >>> **********************************************
> >>>
> >>> An unqualified search in a scope S from a program point P includes the results
> >>> of searches from P in
> >>> — S, and
> >>> — 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.
> >>>
> >>> **********************************************
> >>>
> >>> namespace A {
> >>> int a;
> >>> }
> >>>
> >>> namespace S {
> >>> namespace T {
> >>> namespace U {
> >>> using namespace A;
> >>> int p = a;
> >>> }
> >>> }
> >>> }
> >>>
> >>> int main()
> >>> {
> >>> }
> >>>
> >>> **********************************************
> >>>
> >>> "namespace A" is not contained in "namespace S". So what does the second
> >>> statement mean ?
> >>
> >> There are no (grammatical) statements in your example, except for the
> >> empty block of "main".
> >>
> >> And you're missing the recursion in the next sentence:
> >>
> >> "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 ."
> >>
> >> The scope S here is the global scope, which contains both A and the scope U
> >> in which the using-directive is active.
> >
> > I don't quite follow. When lookup in U is performed, I would expect
> > the using-directive to be active, instead
> > of having it active in the recursive step.
>
> Yes, the using-directive is active, but "each namespace contained by S"
> is not satisfied, because A is (only) contained by the global scope.
Let me be clearer about what I mean. I expect searches for names in U
to find names in A, because
the using-directive is there.
I don't expect that name lookup to fail to find names in A, and then
continue searching into the outer scopes,
and then perhaps managing to find names in A only after the searches
bubble up all the way to the global scope.
The wording seems to suggest the thing I am not expecting.
>
>
>
> On 11/30/25 15:43, Ville Voutilainen wrote:
> > On Sun, 30 Nov 2025 at 00:42, Jens Maurer via Std-Discussion
> > <std-discussion_at_[hidden]> wrote:
> >>
> >>
> >>
> >> On 11/29/25 15:04, Russell Shaw via Std-Discussion wrote:
> >>> Hi,
> >>>
> >>> In [basic.lookup.unqual]:
> >>>
> >>> **********************************************
> >>>
> >>> An unqualified search in a scope S from a program point P includes the results
> >>> of searches from P in
> >>> — S, and
> >>> — 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.
> >>>
> >>> **********************************************
> >>>
> >>> namespace A {
> >>> int a;
> >>> }
> >>>
> >>> namespace S {
> >>> namespace T {
> >>> namespace U {
> >>> using namespace A;
> >>> int p = a;
> >>> }
> >>> }
> >>> }
> >>>
> >>> int main()
> >>> {
> >>> }
> >>>
> >>> **********************************************
> >>>
> >>> "namespace A" is not contained in "namespace S". So what does the second
> >>> statement mean ?
> >>
> >> There are no (grammatical) statements in your example, except for the
> >> empty block of "main".
> >>
> >> And you're missing the recursion in the next sentence:
> >>
> >> "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 ."
> >>
> >> The scope S here is the global scope, which contains both A and the scope U
> >> in which the using-directive is active.
> >
> > I don't quite follow. When lookup in U is performed, I would expect
> > the using-directive to be active, instead
> > of having it active in the recursive step.
>
> Yes, the using-directive is active, but "each namespace contained by S"
> is not satisfied, because A is (only) contained by the global scope.
Let me be clearer about what I mean. I expect searches for names in U
to find names in A, because
the using-directive is there.
I don't expect that name lookup to fail to find names in A, and then
continue searching into the outer scopes,
and then perhaps managing to find names in A only after the searches
bubble up all the way to the global scope.
The wording seems to suggest the thing I am not expecting.
Received on 2025-11-30 21:15:32
