Skip to content

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

Closed
@CaseyCarter

Description

@CaseyCarter
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?

Activity

CaseyCarter

CaseyCarter commented on Jan 7, 2022

@CaseyCarter
ContributorAuthor

@opensdh, any thoughts (or prayers)?

opensdh

opensdh commented on Jan 7, 2022

@opensdh
Contributor

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

xmh0511

xmh0511 commented on Jan 7, 2022

@xmh0511
Contributor

@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

CaseyCarter commented on Jan 7, 2022

@CaseyCarter
ContributorAuthor

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

opensdh commented on Jan 7, 2022

@opensdh
Contributor

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

jensmaurer commented on Jan 7, 2022

@jensmaurer
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

opensdh commented on Jan 7, 2022

@opensdh
Contributor

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.

self-assigned this
on Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @CaseyCarter@xmh0511@jensmaurer@opensdh

    Issue actions

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