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


2189. Surrogate call template

Section:  []     Status: open     Submitter: Jason Merrill     Date: 2015-10-22


  template <class T>
  using Fn = void (*)(T);

  struct A
    template <class T>
    operator Fn<T>();

  int main()
  } [] describes how conversion functions to pointer/reference to function work in overload resolution, but is silent about conversion function templates. Generalizing the wording there, in this case we could generate a surrogate conversion template
template <class T>
  void /surrogate/ (Fn<T> f, T a) { return f(a); }
which would work as expected. But it seems that implementations don't actually do this currently.