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


1546. Errors in function template default arguments

Section: 13.10.3  [temp.deduct]     Status: NAD     Submitter: Jason Merrill     Date: 2012-08-27

Given an example like

  template <class T> void f (T, int = T());
  template <class T> auto g(T t) -> decltype (f(t));
  void g(int);

  struct A { A(int); operator int(); };

  int main() {
    g(A(42));
  }

it seems that since the default argument is treated as a separate template, its ill-formedness causes a hard error, rather than a substitution failure for g. Is this what we want?

Rationale (October, 2012):

CWG felt that this was acceptable; also, there is discussion in EWG regarding changes to the SFINAE rules that could affect this case.