Title
Omitting an empty template argument list
Status
ready
Section
13.10.2 [temp.arg.explicit]
Submitter
Anoop Rana

Created on 2022-07-03.00:00:00 last changed 1 month ago

Messages

Date: 2022-07-15.19:21:32

Proposed resolution (approved by CWG 2022-07-15):

Change in 13.10.2 [temp.arg.explicit] paragraph 4 as follows:

... 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.
Date: 2022-07-15.19:21:32

Subclause 13.10.2 [temp.arg.explicit] paragraph 4 specifies:

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, they may all be omitted; in this case, the empty template argument list <> itself may also be omitted.

The wording does not allow omitting the empty template argument list <> if all of the template arguments have been obtained from default template-arguments. For example:

  template<typename T = int>
  int f();

  int x = f();      // ill-formed per the wording
  int (*y)() = f;   // ditto
History
Date User Action Args
2022-07-15 19:21:32adminsetstatus: open -> ready
2022-07-08 20:55:20adminsetmessages: + msg6879
2022-07-03 00:00:00admincreate