[regression] Clang 22 fails to properly evaluate concept during template instantiation
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
## Description of the problem
Consider this reduced example:
```c++
template
struct index_sequence {};
template
concept callable = requires(F f, Args... args) {
f(args...);
};
struct param {};
template
using expand = T;
template
struct parameter_sequence_impl {};
template
requires(callable)
struct parameter_sequence_impl> {
using type = index_sequence<>;
};
template
requires(callable...>)
struct parameter_sequence_impl> {
using type = index_sequence;
};
template
struct parameter_sequence_impl> :
parameter_sequence_impl> {};
auto f = [](param){};
using t = parameter_sequence_impl>::type;
```
https://godbolt.org/z/x3Ks8PTj5
Clang 21 and other compilers compiles this valid code with success. Clang 22 fails to evaluate the TMP properly. This happens in all modes (20, 23, 26)
## Existing Workaround
```c++
template
struct index_sequence {};
template
concept callable = requires(F f, Args... args) {
f(args...);
};
struct param {};
template
using expand = T;
template
inline constexpr auto callable_workaround_for_clang =
callable...>;
template
struct parameter_sequence_impl {};
template
requires(callable)
struct parameter_sequence_impl> {
using type = index_sequence<>;
};
template
requires(callable_workaround_for_clang)
struct parameter_sequence_impl> {
using type = index_sequence;
};
template
struct parameter_sequence_impl> :
parameter_sequence_impl> {};
auto f = [](param){};
using t = parameter_sequence_impl>::type;
```
https://godbolt.org/z/re7bfW95z
Clang 22 accepts this code if we define a template variable instead of using the concept.
Contributor guide
Assessment
This issue has not been assessed yet.