Closed xtactis closed 4 weeks ago
@llvm/issue-subscribers-clang-frontend
Author: Matija Dizdar (xtactis)
a smaller example with the same behavior
#include <tuple>
template <class, class>
concept C = false;
template <class... Ts>
auto f(Ts...) {
return std::tuple{
[](std::same_as<Ts> auto){} ...
};
}
int main() {
auto [a, b] = f(42, "arst");
a(43);
}
Note that the crash happens when evaluating a(43);
, and that the following program compiles fine
#include <tuple>
template <class... Ts>
auto f(Ts...) {
return std::tuple{
[](Ts){} ...
};
}
int main() {
auto [a, b] = f(42, "arst");
a(43);
}
I guess this is another case where the constraints are not properly expanded in a fold expression. It's similar to the symptoms in https://github.com/llvm/llvm-project/pull/86265, but I have dropped the fix for constraints (hopefully to speed up the review process) in that patch.
The following program causes the clang frontend to crash.
This is likely a regression between clang++15 and clang++16, as 15 has the correct behavior, but all later versions crash. Happens when compiling with -std=c++20, c++23, c++2b and c++2c. I wasn't able to find a version of GCC that has the correct behavior, all of them seem to believe this is an ill-formed program.
Godbolt link: https://godbolt.org/z/7czh4ndcv
Backtrace:
main-568d09.zip.zip