[PATCH] D122768: [Clang][C++20] Support capturing structured bindings in lambdas
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 13 08:45:56 PDT 2022
cor3ntin added a comment.
@shafik Thanks for the review. I was able to reorganize the things you pointed out to be more consistent such that the checks for structured bindings and regular vars are made in the same place.
I think it's much better that way. It took me a while to find the correct way to do that, which was somewhat useful in hindsight.
================
Comment at: clang/lib/Sema/SemaInit.cpp:7851
+ bool InitCapture =
+ isa<VarDecl>(VD) && cast<VarDecl>(VD)->isInitCapture();
Diag(Elem.Capture->getLocation(), diag::note_lambda_capture_initializer)
----------------
shafik wrote:
> I see we are doing this kind of check to see if we have a `VarDecl` and then check if it is an init capture and I wish there was a way not to repeat this but I don't see it.
I considered having a function In ValueDecl, what do you think?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122768/new/
https://reviews.llvm.org/D122768
More information about the cfe-commits
mailing list