================
@@ -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());
+    bool Changed = false;
+    auto Init = CaptureInits.begin();
+    for (LambdaExpr::capture_iterator C = E->capture_begin(),
+                                      CEnd = E->capture_end();
+         C != CEnd; ++C, ++Init) {
----------------
shafik wrote:

Please don't use images like this. We can block quote code and console output 
and it will display nicely use `` ```cpp ``and `` ```console ``

https://github.com/llvm/llvm-project/pull/229953
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to