[clang] [Clang] Fix incorrect mutability of decltype((x)) in lambda return types (PR #180690)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 10 00:42:46 PST 2026


================
@@ -1383,6 +1383,9 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
     addStaticToLambdaDeclSpecifier(*this, StaticLoc, DS);
     addConstexprToLambdaDeclSpecifier(*this, ConstexprLoc, DS);
     addConstevalToLambdaDeclSpecifier(*this, ConstevalLoc, DS);
+    if (clang::sema::LambdaScopeInfo *LSI = Actions.getCurLambda()) {
+      LSI->Mutable = MutableLoc.isValid();
+    }
----------------
cor3ntin wrote:

This is not quite correct. My guess is that we should call `ActOnLambdaClosureQualifiers` (that call is currently on line 1451) before calling `ParseTrailingReturnType` (instead of after) (starting on line 1425)

@zyn0217  

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


More information about the cfe-commits mailing list