-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Clang behaves different with other compilers for constraint nested lambdas #134193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-frontend Author: Younan Zhang (zyn0217)
Both were discovered in #133719, but the underlying causes are different from the original issue so I filed a separate one to track these.
template <class T>
constexpr auto f{[] (auto arg) {
return [a{arg}] {
[] () requires (a == 1) {}();
};
}};
int main() {
f<int>(0);
} https://compiler-explorer.com/z/Tq9xzrPns
void f() {
auto f{
[](auto arg) {
return [a = arg]()
requires (a == 1)
{ return a;};
}
};
f(10);
}
https://godbolt.org/z/ncYx8q9f6 This has started since Clang 16. |
|
Looks like that I was confused. It seems that we should at least reject this void f() {
auto l2 = []<class = void>() {
return [a = 10]() requires (a == 1) { return a; };
}();
} |
This one is perhaps valid, but seemingly causes infinite recursion in Clang (Godbolt link). struct ConvToOne {
constexpr operator int() const { return 1; }
};
void g() {
auto l2 = []<class = void>() {
return [a = ConvToOne{}]() requires (a == 1) { return a; };
}();
l2();
} |
CC @cor3ntin |
Both were discovered in #133719, but the underlying causes are different from the original issue so I filed a separate one to track these.
https://compiler-explorer.com/z/Tq9xzrPns
https://godbolt.org/z/ncYx8q9f6
This has started since Clang 16.
The text was updated successfully, but these errors were encountered: