[PATCH] D137244: [Clang] Correctly capture bindings in dependent lambdas.

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 08:31:12 PST 2023


cor3ntin added inline comments.


================
Comment at: clang/lib/AST/DeclCXX.cpp:3232
+VarDecl *ValueDecl::getPotentiallyDecomposedVarDecl() {
+  assert((isa<VarDecl>(this) || isa<BindingDecl>(this)) &&
+         "expected a VarDecl or a BindingDecl");
----------------
aaron.ballman wrote:
> cor3ntin wrote:
> > aaron.ballman wrote:
> > > 
> > That's future tech, `assert` would part that as 2 macros arguments!
> Ugh.
> 
> `(isa<VarDecl, BindingDecl>(this)) && ...`
> 
> should suppress that problem, right? I don't feel strongly though.
Oh right, that works too :)


================
Comment at: clang/lib/Sema/SemaExpr.cpp:19648-19649
     // odr-used, but we may still need to track them for lambda capture.
     // FIXME: Do we also need to do this inside dependent typeid expressions
     // (which are modeled as unevaluated at this point)?
+    DoMarkPotentialCapture(SemaRef, Loc, Var, E);
----------------
aaron.ballman wrote:
> Should this comment be moved elsewhere, as it now seems detached from the original logic.
I think it's still relevant. the logic is still doing lambda captures, and we still don't need to do anything else, and the fixme is not resolved.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137244/new/

https://reviews.llvm.org/D137244



More information about the cfe-commits mailing list