Skip to content

[basic.lookup.unqual] Clarify conversion-function-id components lookup #5191

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1777,13 +1777,15 @@
such a name undergoes unqualified name lookup from the point where it appears.

\pnum
An unqualified name that is a component name\iref{expr.prim.id.unqual} of
Lookup for an unqualified name $U$
that is a component name\iref{expr.prim.id.unqual} of
a \grammarterm{type-specifier} or \grammarterm{ptr-operator} of
a \grammarterm{conversion-type-id} is looked up in the same fashion
as the \grammarterm{conversion-function-id} in which it appears.
If that lookup finds nothing, it undergoes unqualified name lookup;
in each case, only names
that denote types or templates whose specializations are types are considered.
a \grammarterm{conversion-type-id} $T$ considers only names
that denote types or templates whose specializations are types.
If $T$ appears in a \grammarterm{conversion-function-id} that is a qualified name
whose lookup context\iref{basic.lookup.qual} is a class $S$,
lookup for $U$ performs a search in the scope associated with $S$;
if that lookup finds nothing, $U$ undergoes unqualified name lookup.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be clearer to say "[…]; otherwise, or if that lookup finds nothing, […]". It's true that the general "Unless otherwise specified" from the previous paragraph ought to apply, but it tends to sound like the alternative is that the name is not looked up at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true that the general "Unless otherwise specified" from the previous paragraph ought to apply, but it tends to sound like the alternative is that the name is not looked up at all.

To me, the previous paragraph clearly applies to unqualified \grammarterm{conversion-function-id} :/
May I not apply the proposed change, please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph is about an unqualified U, looked up separately from the conversion-function-id that contains it. I want to avoid the (nonsensical) suggestion that, if T does not appear in the given context, U is not looked up at all.

Copy link
Contributor Author

@languagelawyer languagelawyer Feb 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph is about an unqualified U, looked up separately from the conversion-function-id that contains it.

Yeah, right, but whatever, the previous paragraph applies to other unqualified names (which are not mentioned in this paragraphs) (and in any other paragraphs-exceptions).

I want to avoid the (nonsensical) suggestion that, if T does not appear in the given context, U is not looked up at all.

I don't see how is it possible. I mean, not only the previous paragraph, but also the previous sentence suggest that such U s are looked up:

Lookup for an unqualified name U that is ... of a conversion-type-id T considers only names that ... If T appears in a conversion-function-id ...

If U is not looked up when T doesn't appear in conversion-function-id, there is no reason these sentences are in this and not the opposite order

Copy link
Contributor

@opensdh opensdh Feb 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't insist on a change; it just strikes me as a trip hazard for the reader to say "If X, then Y; if Y does nothing, Z." and have Z also happen when X doesn't obtain.

\begin{example}
\begin{codeblock}
struct T1 { struct U { int i; }; };
Expand Down