Title
Dependent names in non-defining declarations
Status
cd6
Section
13.8.4 [temp.dep.res]
Submitter
Sean Hunt

Created on 2010-02-03.00:00:00 last changed 28 months ago

Messages

Date: 2011-02-15.00:00:00

Additional note (February, 2011):

The resolution of this issue can't simply replace the word “definition” with the word “declaration,” mutatis mutandis, because there can be multiple declarations in a translation unit (which isn't true of “the definition”). As a result, the issue was moved back to "open" status for further consideration.

Date: 2020-11-15.00:00:00

[Accepted at the November, 2020 meeting as part of paper P1787R6 and moved to DR at the February, 2021 meeting.]

The current wording of 13.8.4 [temp.dep.res] seems to assume that dependent names can only appear in the definition of a template:

In resolving dependent names, names from the following sources are considered:

  • Declarations that are visible at the point of definition of the template.

  • Declarations from namespaces associated with the types of the function arguments both from the instantiation context (13.8.4.1 [temp.point]) and from the definition context.

However, dependent names can occur in non-defining declarations of the template as well; for instance,

    template<typename T>
    T foo(T, decltype(bar(T())));

bar needs to be looked up, even though there is no definition of foo in the translation unit.

History
Date User Action Args
2022-08-19 07:54:33adminsetstatus: drwp -> cd6
2021-02-24 00:00:00adminsetstatus: accepted -> drwp
2020-12-15 00:00:00adminsetstatus: open -> accepted
2011-02-28 00:00:00adminsetmessages: + msg3266
2011-02-28 00:00:00adminsetstatus: drafting -> open
2010-08-23 00:00:00adminsetstatus: open -> drafting
2010-02-03 00:00:00admincreate