Title
How similar are template default arguments to function default arguments?
Status
drafting
Section
13.2 [temp.param]
Submitter
Richard Smith

Created on 2013-03-06.00:00:00 last changed 6 months ago

Messages

Date: 2020-11-15.00:00:00

Additional note (November, 2020):

Paper P1787R6, adopted at the November, 2020 meeting, partially addresses this issue.

Date: 2013-03-06.00:00:00

Default function arguments are instantiated only when needed. Is the same true of default template arguments? For example, is the following well-formed?

  #include <type_traits>

  template<class T>
  struct X {
    template<class U = typename T::type>
    static void foo(int){}
    static void foo(...){}
  };

  int main(){
    X<std::enable_if<false>>::foo(0);
  }

Also, is the effect on lookup the same? E.g.,

  struct S {
    template<typename T = U> void f();
    struct U {};
  };
History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6243
2013-05-03 00:00:00adminsetstatus: open -> drafting
2013-03-06 00:00:00admincreate