Skip to content

Clang 19 regression matching constrained template to unconstrained template template parameter #104189

Closed
@CaseyCarter

Description

@CaseyCarter

Compiling this program fragment:

template <template <class, class...> class>
constexpr bool f() { return true; }

template <class> class unconstrained {};
static_assert(f<unconstrained>()); // Fine

template <class> concept True = true;
template <True> class constrained {};
static_assert(f<constrained>()); // error: too many template arguments for class template 'constrained'

with clang 19.1.0-rc2 under -std=c++20 diagnoses:

repro.cpp:9:17: error: too many template arguments for class template 'constrained'
    1 | template <template <class, class...> class>
      |                                    ~
    2 | constexpr bool f() { return true; }
    3 |
    4 | template <class> class unconstrained {};
    5 | static_assert(f<unconstrained>()); // Fine
    6 |
    7 | template <class> concept True = true;
    8 | template <True> class constrained {};
    9 | static_assert(f<constrained>()); // error: too many template arguments for class template 'constrained'
      |                 ^
1 error generated.

The constrained case should be as well-formed as the unconstrained case since [temp.arg.template]/3 says the constraints on the argument should be ignored when the template template parameter is not constrained. Note that the release versions of the "big three" (including Clang 18) compile this fragment without issue (https://godbolt.org/z/qYr8orqz7).

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsregression:19Regression in 19 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions