Date
2024-03-15.00:00:00
Message id
7582

Content

[Accepted as a DR at the March, 2024 meeting.]

(From submission #489.)

Subclause 13.9.3 [temp.explicit] paragraph 8 specifies:

A trailing template-argument can be left unspecified in an explicit instantiation of a function template specialization or of a member function template specialization provided it can be deduced (13.10.3.7 [temp.deduct.decl]). If all template arguments can be deduced, the empty template argument list <> may be omitted. [Example 3:
  template<class T> class Array { /* ... */ };
  template<class T> void sort(Array<T>& v) { /* ... */ }

  // instantiate sort(Array<int>&) -- template-argument deduced
  template void sort<>(Array<int>&);
end example]

This paragraph is redundant with a more general provision on explicitly specifying template arguments in 13.10.2 [temp.arg.explicit] paragraph 4:

Trailing template arguments that can be deduced (13.10.3 [temp.deduct]) or obtained from default template-arguments may be omitted from the list of explicit template-arguments. [Note 1: A trailing template parameter pack (13.7.4 [temp.variadic]) not otherwise deduced will be deduced as an empty sequence of template arguments. —end note] If all of the template arguments can be deduced or obtained from default template-arguments, they may all be omitted; in this case, the empty template argument list <> itself may also be omitted. ...

A similar duplication is in 13.9.4 [temp.expl.spec] paragraph 10.