[clang] [Clang] Don't add top-level const qualifiers to captured function types (PR #118050)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 3 21:32:02 PST 2024


================
@@ -18789,7 +18792,11 @@ static bool captureInLambda(LambdaScopeInfo *LSI, ValueDecl *Var,
     //   parameter-declaration-clause is not followed by mutable.
     DeclRefType = CaptureType.getNonReferenceType();
     bool Const = LSI->lambdaCaptureShouldBeConst();
-    if (Const && !CaptureType->isReferenceType())
+    // C++ [dcl.fct]p7:
+    //   [When] adding cv-qualifications on top of the function type [...] the
+    //   cv-qualifiers are ignored.
----------------
zyn0217 wrote:

Thanks, and sorry for missing this review

https://github.com/llvm/llvm-project/pull/118050


More information about the cfe-commits mailing list