Title
Restrictions on the template-head of a concept definition
Status
open
Section
13.2 [temp.param]
Submitter
Corentin Jabot

Created on 2026-07-20.00:00:00 last changed 6 days ago

Messages

Date: 2026-07-25.21:53:26

Suggested resolution:

  1. Change in 13.2 [temp.param] paragraph 19 as follows:

    If a template-parameter of a class template, variable template, concept, or alias template has a default template argument, each subsequent template-parameter shall either have a default template argument supplied or declare a template parameter pack. If a template-parameter of a primary class template, primary variable template, concept, or alias template declares a template parameter pack, it shall be the last template-parameter. If a template-parameter of a function template declares a template parameter pack, it shall not be followed by another template-parameter unless that template parameter is deducible from the parameter-type-list (9.3.4.6 [dcl.fct]) of the function template or has a default argument (13.10.3 [temp.deduct]). A template parameter of a deduction guide template (13.7.2.3 [temp.deduct.guide]) that does not have a default argument shall be deducible from the parameter-type-list of the deduction guide template.
  2. Change in 13.7.9 [temp.concept] as follows:

    The first declared template parameter of a concept definition is its prototype parameter. It shall not have a default argument (13.2 [temp.param]). A type concept is a concept whose prototype parameter is a type template parameter.
Date: 2026-07-20.00:00:00

(From submission #951.)

Consider:

  template <typename T, typename U = int, typename V>
  concept C = true;

  template <typename T = int>
  concept C2 = true;
  static_assert(C2<>);

  template <typename... T, typename... U>
  concept C3 = true;

  template <typename... T, typename U = int>
  concept C4 = true;

  template <typename... T, typename U>
  concept C5 = true;

None of these examples should be valid. There is implementation divergence.

History
Date User Action Args
2026-07-25 21:53:26adminsetmessages: + msg8637
2026-07-20 00:00:00admincreate