This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


164. Overlap between Koenig and normal lookup

Section: 6.5.4  [basic.lookup.argdep]     Status: TC1     Submitter: Derek Inglis     Date: 3 Sep 1999

The description of Koenig lookup in 6.5.4 [basic.lookup.argdep] paragraph 1 says,

...other namespaces not considered during the usual unqualified lookup (6.5.3 [basic.lookup.unqual] ) may be searched.
Does this mean that Koenig lookup does not search namespaces that were already searched during the usual unqualified lookup? The answer is academic except for the two-stage lookup during template instantiation. If a given namespace is searched in the context of the template definition, are declarations in that namespace in the instantiation context ignored during the Koenig lookup? For instance,
    void f(int);

    template <class T> void g(T t) {
        f(t);
    }

    enum E { e };

    void f(E);

    void h() {
        g(e);
    }
In this example, the call f(t) in the template function will resolve to f(E) if Koenig lookup reexamines already-searched namespaces and to f(int) if not.

Proposed Resolution (10/00):

Immediately preceding the example at the end of 6.5.4 [basic.lookup.argdep] paragraph 2, add the following:

[Note: the namespaces and classes associated with the argument types can include namespaces and classes already considered by the ordinary unqualified lookup.]