This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See for the official list.


405. Unqualified function name lookup

Section: 6.5.3  [basic.lookup.unqual]     Status: CD6     Submitter: William M. Miller     Date: 14 Apr 2003

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

There seems to be some confusion in the Standard regarding the relationship between 6.5.3 [basic.lookup.unqual] (Unqualified name lookup) and 6.5.4 [basic.lookup.argdep] (Argument-dependent lookup). For example, 6.5.3 [basic.lookup.unqual] paragraph 3 says,

The lookup for an unqualified name used as the postfix-expression of a function call is described in 6.5.4 [basic.lookup.argdep].

In other words, nothing in 6.5.3 [basic.lookup.unqual] applies to function names; the entire lookup is described in 6.5.4 [basic.lookup.argdep].

6.5.4 [basic.lookup.argdep] does not appear to share this view of its responsibility. The closest it comes is in 6.5.4 [basic.lookup.argdep] paragraph 2a:

...the set of declarations found by the lookup of the function name is the union of the set of declarations found using ordinary unqualified lookup and the set of declarations found in the namespaces and classes associated with the argument types.

Presumably, "ordinary unqualified lookup" is a reference to the processing described in 6.5.3 [basic.lookup.unqual], but, as noted above, 6.5.3 [basic.lookup.unqual] explicitly precludes applying that processing to function names. The details of "ordinary unqualified lookup" of function names are not described anywhere.

The other clauses that reference 6.5.4 [basic.lookup.argdep], clauses Clause 12 [over] and Clause 13 [temp], are split over the question of the relationship between 6.5.3 [basic.lookup.unqual] and 6.5.4 [basic.lookup.argdep]. [] paragraph 3, for instance, says

The name is looked up in the context of the function call following the normal rules for name lookup in function calls (6.5.4 [basic.lookup.argdep]).

I.e., this reference assumes that 6.5.4 [basic.lookup.argdep] is self-contained. The same is true of [over.match.oper] paragraph 3, second bullet:

The set of non-member candidates is the result of the unqualified lookup of operator@ in the context of the expression according to the usual rules for name lookup in unqualified function calls (6.5.4 [basic.lookup.argdep]), except that all member functions are ignored.

On the other hand, however, [temp.dep.candidate] paragraph 1 explicitly assumes that 6.5.3 [basic.lookup.unqual] and 6.5.4 [basic.lookup.argdep] are both involved in function name lookup and do different things:

For a function call that depends on a template parameter, if the function name is an unqualified-id but not a template-id, the candidate functions are found using the usual lookup rules (6.5.3 [basic.lookup.unqual], 6.5.4 [basic.lookup.argdep]) except that:

Suggested resolution:

Change 6.5.3 [basic.lookup.unqual] paragraph 1 from lookup ends as soon as a declaration is found for the name.

to lookup ends with the first scope containing one or more declarations of the name.

Change the first sentence of 6.5.3 [basic.lookup.unqual] paragraph 3 from

The lookup for an unqualified name used as the postfix-expression of a function call is described in 6.5.4 [basic.lookup.argdep].


An unqualified name used as the postfix-expression of a function call is looked up as described below. In addition, argument-dependent lookup (6.5.4 [basic.lookup.argdep]) is performed on this name to complete the resulting set of declarations.