| Issue |
184047
|
| Summary |
Clang 22.1.0 crash when evaluating nested requires-clause using concept inside requires-_expression_
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
msvetkin
|
Clang 22.1.0 crashes (segmentation fault, exit code 139) while evaluating a concept used inside a nested requires _expression_.
The crash occurs when a concept is referenced inside a requires { requires ...; } construct, while the same concept works correctly when used directly or aliased through another concept.
Clang 21 compiles this code correctly.
The code also compiles successfully with GCC and MSVC.
Godbolt link: https://godbolt.org/z/GPKW5jcz3
Example:
```cpp
template <typename T, int N>
concept decomposable = requires {
[]<template <typename...> class U, typename... Args>
requires(sizeof...(Args) >= N)
(U<Args...>*) {}(static_cast<T*>(nullptr));
};
template<typename T>
struct foo {};
static_assert(decomposable<int, 1> == false);
static_assert(decomposable<foo<int>, 1> == true);
template<typename T>
concept decomposable_works = decomposable<T, 1>;
static_assert(decomposable_works<foo<double>>); // if changed to foo<int>, no crash
template<typename T>
concept decomposable_fails = requires {
requires decomposable<T, 1>;
};
static_assert(decomposable_fails<foo<int>>); // crash here
```
Additionally, the crash is sensitive to instantiation order:
If this line `static_assert(decomposable_works<foo<double>>);` is changed to `static_assert(decomposable_works<foo<int>>);` then the program compiles successfully even with Clang 22.1.0.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs