[PATCH] D124351: [Clang][WIP] Implement Change scope of lambda trailing-return-type - Take 2
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 25 06:13:12 PST 2022
cor3ntin updated this revision to Diff 477938.
cor3ntin added a comment.
Rebase. This is still a bit rough, I have a few tests to fix
and some dead code to remove.
---
@erichkeanne I wouldn't mind picking your brain on this.
Consider:
template <typename T>
void dependent_init_capture(T x = 0) {
[y = x] () requires (decltype(y){1}) {
return y;
}();
}
void test_dependent() {
dependent_init_capture(0);
}
This used to ""work"" in the previous iteration of the patch,
but with the late concept checking it seems more involved.
My understanding so far is that in `CheckFunctionConstraints`
we can't find an instanciated declaration of `y` (so it asserts in `LocalInstantiationScope::findInstantiationOf`).
I'm not 100% sure of what's the correct approach here would be.
My guess is that we might need to retransform the captures in the instanciation scope used
for constraint checking?
I'm not actually sure whether an instanciation of the lambda does exist at that point in some other scope,
though. Ideally we would not instannciate lambdas more times than needed.
Another issue is that there is no way to walk back from a call expression to a lambda expression,
so we might need to add that.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124351/new/
https://reviews.llvm.org/D124351
Files:
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/DeclCXX.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Parse/Parser.h
clang/include/clang/Sema/Scope.h
clang/include/clang/Sema/ScopeInfo.h
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseExprCXX.cpp
clang/lib/Sema/Scope.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaCXXScopeSpec.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/TreeTransform.h
clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp
clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp
clang/test/SemaCXX/lambda-capture-type-deduction.cpp
clang/test/SemaCXX/warn-shadow-in-lambdas.cpp
clang/www/cxx_status.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124351.477938.patch
Type: text/x-patch
Size: 91347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221125/c4a1d30b/attachment-0001.bin>
More information about the cfe-commits
mailing list