================
@@ -5793,11 +5798,57 @@ struct EnsureImmediateInvocationInDefaultArgs
bool AlwaysRebuild() { return true; }
- // Lambda can only have immediate invocations in the default
- // args of their parameters, which is transformed upon calling the closure.
- // The body is not a subexpression, so we have nothing to do.
- // FIXME: Immediate calls in capture initializers should be transformed.
- ExprResult TransformLambdaExpr(LambdaExpr *E) { return E; }
+ // Lambda default arguments are transformed upon calling the closure. The
+ // body is not a subexpression, so only transform init-captures here.
+ ExprResult TransformLambdaExpr(LambdaExpr *E) {
+ SmallVector<Expr *, 4> CaptureInits(E->capture_inits().begin(),
+ E->capture_inits().end());
----------------
Fznamznon wrote:
That array seems a bit redundant, Init can be initialized with
`capture_init_begin()` and I'm sure there is probably a proper accessor to pass
an array to `LambdaExpr::Create` later.
https://github.com/llvm/llvm-project/pull/229953
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits