Title
Errors in function template default arguments
Status
nad
Section
13.10.3 [temp.deduct]
Submitter
Jason Merrill

Created on 2012-08-27.00:00:00 last changed 147 months ago

Messages

Date: 2012-10-15.00:00:00

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.

Date: 2022-11-20.07:54:16

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?

History
Date User Action Args
2012-11-03 00:00:00adminsetmessages: + msg4183
2012-11-03 00:00:00adminsetstatus: open -> nad
2012-08-27 00:00:00admincreate