[clang] [Clang] Don't add top-level const qualifiers to captured function types (PR #118050)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 2 03:13:17 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.
----------------
cor3ntin wrote:
I think the more relevant wording is https://eel.is/c++draft/expr.prim.lambda#capture-10.sentence-4
https://github.com/llvm/llvm-project/pull/118050
More information about the cfe-commits
mailing list