This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


2520. Template signature and default template arguments

Section: 3.51  [defns.signature.templ]     Status: C++23     Submitter: John Spicer     Date: 2022-01-25

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

According to 3.51 [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.

CWG 2022-11-11

CWG agrees with the suggested direction.

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

  1. Change in 3.50 [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.51 [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.54 [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)