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

2026-05-02


3186. Argument-dependent lookup is for a name

Section: 6.5.4  [basic.lookup.argdep]     Status: open     Submitter: CWG     Date: 2026-04-25

(From submission #891.)

Consider:

  namespace N {
    struct C {
      friend void f(C);
      friend void g(C);
    };
  }

  void h() {
    f(N::C{});
  }

According to 6.5.4 [basic.lookup.argdep] paragraph 4, argument-dependent lookup finds functions without considering their names (such as g in the example above). This is misguided.

Possible resolution:

Change in 6.5.4 [basic.lookup.argdep] paragraph 4 as follows:

The associated namespaces for a call are the innermost enclosing non-inline namespaces for its associated entities as well as every element of the inline namespace set (9.9.2 [namespace.def]) of those namespaces. Argument-dependent lookup for a name N finds all declarations of functions and function templates named N that If the lookup is for a N is dependent name (13.8.3 [temp.dep], 13.8.4.2 [temp.dep.candidate]), the above lookup is also performed from each point in the instantiation context (10.6 [module.context]) of the lookup, additionally ignoring any declaration that appears in another translation unit, is attached to the global module, and is either discarded (10.4 [module.global.frag]) or has internal linkage.