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

2024-12-19


2888. Missing cases for reference and array types for argument-dependent lookup

Section: 6.5.4  [basic.lookup.argdep]     Status: review     Submitter: Lewis Baker     Date: 2024-04-30

The specification for associated entities in argument-dependent lookup recurses into template argument types, but misses handling reference and array cases. Those cannot appear for function arguments. For example:

  namespace N {
    template<typename T>
    struct A {
      operator T() const noexcept;
    };
  }
  namespace M {
    struct B {};
    void f(B&);
  }

  void caller() {
    N::A<M::B&> arg;
    f(arg);
  }

Possible resolution:

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

For each argument type T in the function call, there is a set of zero or more associated entities to be considered. The set of entities is determined entirely by the types of the function arguments (and any template template arguments). Any typedef-names and using-declarations used to specify the types do not contribute to this set. The set of associated entities for a type cv T is determined in the following way: In addition, if the argument is an overload set or the address of such a set, its associated entities are the union of those associated with each of the members of the set, i.e., the entities associated with its parameter types and return type. Additionally, The associated entities of a function call are the associated entities of each argument A of the call, consisting of