Closed
Description
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).