Title
Template signature and default template arguments
Status
review
Section
3.54 [defns.signature.templ]
Submitter
John Spicer

Created on 2022-01-25.00:00:00 last changed 2 weeks ago

Messages

Date: 2022-11-20.07:54:16

CWG 2022-11-11

CWG agrees with the suggested direction.

Possible resolution:

  1. Change in 3.53 [defns.signature.friend] as follows:

    signature
    <function template>
    name, parameter-type-list, enclosing namespace, return type, template-head excluding default template arguments, and trailing requires-clause (if any)
  2. Change in 3.54 [defns.signature.templ] as follows:

    signature
    <friend function template with constraint involving enclosing template parameters>
    name, parameter-type-list, return type, enclosing class, template-head excluding default template arguments, and trailing requires-clause (if any)
  3. Change in 3.57 [defns.signature.member] as follows:

    signature
    <class member function template>
    name, parameter-type-list, class of which the function is a member, cv-qualifiers (if any), ref-qualifier (if any), return type (if any), template-head excluding default template arguments, and trailing requires-clause (if any)
Date: 2022-01-25.00:00:00

According to 3.54 [defns.signature.templ], the signature of a function template includes:

name, parameter-type-list, enclosing namespace, return type, template-head, and trailing requires-clause (if any)

The mention of the template-head is a change from previous versions of the Standard, which referred to the “template parameter list”, in order to include the requires-clause in the signature. However, template-head is a syntactic nonterminal and thus includes everything in that production, including default template arguments. It seems undesirable to make the default arguments part of the template signature.

History
Date User Action Args
2022-11-20 07:54:16adminsetmessages: + msg7047
2022-11-20 07:54:16adminsetstatus: open -> review
2022-01-25 00:00:00admincreate