-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Concept checking assertion in Clang 16 #64086
Comments
Also crashes in |
@llvm/issue-subscribers-c-20 |
@llvm/issue-subscribers-clang-frontend |
Well this is neat. When trying to reduce the test case, you can remove the include to |
For reference, the assertion is:
|
I suspect this is one more case of trying to instantiate lambda body too early, @erichkeane is meaning to get to that at some point |
I've gotten it reduced further to: struct S1 {
int f1() { return 1; }
};
template <typename T>
concept C = true;
void foo() {
auto make_caller = []<auto member> {
return [](S1* ps) {
if constexpr (requires { { (ps->*member)() } -> C; })
;
};
};
auto* caller = make_caller.operator()<&S1::f1>();
} |
Removing the return value from the |
I have another case of this assertion here, which is concepts + partial specialization: #49570 (comment) |
Oh ok mine is lambda related too, but the concept on the specialization somehow is needed to trigger it as well. But using a template function instead of a lambda prevents the crash there as well. |
Using a lambda in a requires clause can cause clang to assert, so move to a named function instead. Clang bug: llvm/llvm-project#64086
Using a lambda in a requires clause can cause clang to assert, so move to a named function instead. Clang bug: llvm/llvm-project#64086
Using a lambda in a requires clause can cause clang to assert, so move to a named function instead. Clang bug: llvm/llvm-project#64086
Looks similar to #63808 |
I am trying to fix this bug. It seems that the template argument depth passed in when instantiating |
…odies (#76967) Currently, due to the incomplete implementation of p0588r1, the instantiation of lambda expressions leads to the instantiation of the body. And `EvaluateConstraints` is false during the instantiation of the body, which causes crashes during the instantiation of the return type requirement: ```cpp template<typename T> concept doesnt_matter = true; template<class T> concept test = []{ return requires(T t) { { t } -> doesnt_matter; // crash }; }(); static_assert(test<int>); ``` Although a complete implementation of p0588r1 can solve these crashes, it will take some time. Therefore, this pull request aims to fix these crashes first. Fixes #63808 Fixes #64607 Fixes #64086
Clang 14: https://godbolt.org/z/T7vY6Ydcq OK
Clang 15: https://godbolt.org/z/cYse4o87b OK
Clang 16: https://godbolt.org/z/eoTzGe413 Boom!
Context: https://stackoverflow.com/q/76741924/181238
The text was updated successfully, but these errors were encountered: