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

[temp.res.general]/1 What does "is or is reachable" mean? #5189

Closed
CaseyCarter opened this issue Jan 7, 2022 · 7 comments · Fixed by #5190
Closed

[temp.res.general]/1 What does "is or is reachable" mean? #5189

CaseyCarter opened this issue Jan 7, 2022 · 7 comments · Fixed by #5190
Assignees

Comments

@CaseyCarter
Copy link
Contributor

The first sentence of the cited paragraph (which was merged verbatim from P1787R6 "Declarations and where to find them") is:

A name that appears in a declaration $D$ of a template $T$ is looked up from where it appears in an unspecified declaration of $T$ that is or is reachable from $D$ and from which no other declaration of $T$ that contains the usage of the name is reachable.

Is "A declaration of $T$ that is" an incredibly awkard way to say "any declaration of $T$"? Or should "is or" be struck from this sentence?

@CaseyCarter
Copy link
Contributor Author

@opensdh, any thoughts (or prayers)?

@opensdh
Copy link
Contributor

opensdh commented Jan 7, 2022

It means "that is D or is reachable from D".

@xmh0511
Copy link
Contributor

xmh0511 commented Jan 7, 2022

@CaseyCarter @opensdh At the first glance of this sentence, it's hard to read. Fortunately, [temp.over.link.example] p3 has great help to understand the meaning.

template <class T> decltype(g(T())) h();
int g(int);
template <class T> decltype(g(T())) h()         // redeclaration of h() uses the earlier lookup…
  { return g(T()); }                            // … although the lookup here does find g(int)
int i = h<int>();                               // template argument substitution fails; g(int)
                                                // not considered at the first declaration of h()

@CaseyCarter
Copy link
Contributor Author

Would anyone object to changing this sentence to:

 A name that appears in a declaration $D$ of a template $T$ is looked up from where it appears in an unspecified
 declaration of $T$ that is
+either $D$ itself
 or is reachable from $D$ and from which no other declaration of $T$ that contains the usage
 of the name is reachable.

which I think preserves the intended meaning but would have been easier for me to decode?

@opensdh
Copy link
Contributor

opensdh commented Jan 7, 2022

Give a man a clarification and he reads for a day. Teach a man to parse arbitrary grammatical English sentences and he reads for a lifetime.

(Other than that, no.)

@jensmaurer
Copy link
Member

Give a man a clarification and he reads for a day. Teach a man to parse arbitrary grammatical English sentences and he reads for a lifetime.

What about women?

@opensdh
Copy link
Contributor

opensdh commented Jan 7, 2022

The received wisdom addresses only the adult male case. I suspect women are also capable of eating and catching fish, but since I was stretching the saying already by applying it to reading, I didn't want to press my luck by assuming.

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 a pull request may close this issue.

4 participants