https://github.com/StefanPaulet created 
https://github.com/llvm/llvm-project/pull/217021

Resolves #213420.

The problem introduced in #211811 is that the search for the `LambdaScopeInfo` 
corresponding to the current lambda operator stops at the first scope info that 
is not a `CapturingScopeInfo`. 
This is relevant in `getCurLambda` (where I looked when implementing the PR), 
but not here.

>From 55e1c750e98cfcea5450d880a891907a7fe1ed2c Mon Sep 17 00:00:00 2001
From: StefanPaulet <[email protected]>
Date: Tue, 18 Aug 2026 15:38:56 +0300
Subject: [PATCH] Fix issue introduced by pr 211811

---
 clang/lib/Sema/SemaExpr.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 0908841dca8bf..d06079a43e23a 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -2122,8 +2122,7 @@ static Decl *getPredefinedExprDecl(Sema &S, DeclContext 
*DC) {
   auto tryAdjustLambdaContext = [&S, &LSI](DeclContext *&DC) {
     if (isLambdaCallOperator(DC)) {
       auto E = S.FunctionScopes.rend();
-      while (LSI != E && isa<CapturingScopeInfo>(*LSI) &&
-             !isa<LambdaScopeInfo>(*LSI))
+      while (LSI != E && !isa<LambdaScopeInfo>(*LSI))
         ++LSI;
       assert(LSI != E && "Should be in a lambda scope info");
       if (dyn_cast<LambdaScopeInfo>(*LSI)->BeforeCompoundStatement)

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

Reply via email to