-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Regression introduced with implementation of P2036R3 (assertion error) #65067
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
With only this snippet it doesn't trigger, but with the full translation unit from MongoDB we can get a SIGSEGV later on if assertions are disabled.
|
@llvm/issue-subscribers-clang-frontend |
reduced to template <typename> class a {
public:
template <typename b> void c(b f) { d<int>(f)(); }
template <typename, typename b> auto d(b f) {
return [f = f](auto... args) -> a<decltype(f(args...))> { return {}; };
}
};
a<void> e;
auto fn1() {
e.c([] {});
}
|
This looks like a duplicate of #63675 |
I think in |
This is a duplicate of #63675. I will close this one to avoid duplicating the discussion! Thanks for reporting it |
@cor3ntin : Yes, I think that sounds about right. |
Like concepts checking, a trailing return type of a lambda in a dependent context may refer to captures in which case they may need to be rebuilt, so the map of local decl should include captures. This patch reveal a pre-existing issue. `this` is always recomputed by TreeTransform. `*this` (like all captures) only become `const` after the parameter list. However, if try to recompute the value of `this` (in a parameter) during template instantiation while determining the type of the call operator, we will determine it to be const (unless the lambda is mutable). There is no good way to know at that point that we are in a parameter or not, the easiest/best solution is to transform the type of this. Note that doing so break a handful of HLSL tests. So this is a prototype at this point. Fixes #65067 Fixes #63675 Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D159126
Like concepts checking, a trailing return type of a lambda in a dependent context may refer to captures in which case they may need to be rebuilt, so the map of local decl should include captures. This patch reveal a pre-existing issue. `this` is always recomputed by TreeTransform. `*this` (like all captures) only become `const` after the parameter list. However, if try to recompute the value of `this` (in a parameter) during template instantiation while determining the type of the call operator, we will determine it to be const (unless the lambda is mutable). There is no good way to know at that point that we are in a parameter or not, the easiest/best solution is to transform the type of this. Note that doing so break a handful of HLSL tests. So this is a prototype at this point. Fixes #65067 Fixes #63675 Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D159126
Like concepts checking, a trailing return type of a lambda in a dependent context may refer to captures in which case they may need to be rebuilt, so the map of local decl should include captures. This patch reveal a pre-existing issue. `this` is always recomputed by TreeTransform. `*this` (like all captures) only become `const` after the parameter list. However, if try to recompute the value of `this` (in a parameter) during template instantiation while determining the type of the call operator, we will determine it to be const (unless the lambda is mutable). There is no good way to know at that point that we are in a parameter or not, the easiest/best solution is to transform the type of this. Note that doing so break a handful of HLSL tests. So this is a prototype at this point. Fixes llvm#65067 Fixes llvm#63675 Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D159126
Hello,
Commit 93d7002 introduced a regression. A reproducing snippet:
This has been reduced from code coming from MongoDB.
Before 93d7002, the
func
indecltype(func(args...)
would refer to the parameterfunc
. After the commit, it would refer to the variablefunc
introduced by the capture. It looks like other parts of the parser (i,e,TemplateInstantiator::TransformDecl
) do not expect to find aVarDecl
and fail to handle them.This regression happens for C++14 and higher, even though "Change scope of lambda trailing-return-type" was introduced with C++23.
The text was updated successfully, but these errors were encountered: