Title
Template signature and default template arguments
Status
c++23
Section
3.50 [defns.signature.templ]
Submitter
John Spicer

Created on 2022-01-25.00:00:00 last changed 8 months ago

Messages

Date: 2023-02-10.00:25:18

Proposed resolution (approved by CWG 2023-02-09):

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

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

    signature
    <friend function template with constraint involving enclosing template parameters>
    name, parameter-type-list, return type, enclosing class, signature of the template-head, and trailing requires-clause (if any)
  3. Change in 3.53 [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), signature of the template-head, and trailing requires-clause (if any)
  4. Add a new section in Clause 3 [intro.defs] as follows:

    signature
    <template-head>
    template parameter list, excluding template parameter names and default arguments, and requires-clause (if any)
Date: 2023-02-07.18:56:51

CWG 2022-11-11

CWG agrees with the suggested direction.

Date: 2023-02-15.00:00:00

[Accepted as a DR at the February, 2023 meeting.]

According to 3.50 [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
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: dr -> open
2023-02-18 18:43:04adminsetstatus: ready -> dr
2023-02-10 23:01:52adminsetstatus: tentatively ready -> ready
2023-02-10 00:25:18adminsetstatus: review -> tentatively ready
2023-02-07 14:43:26adminsetmessages: + msg7166
2022-11-20 07:54:16adminsetmessages: + msg7047
2022-11-20 07:54:16adminsetstatus: open -> review
2022-01-25 00:00:00admincreate