[clang] [Clang] [C++26] Expansion Statements (Part 1: AST) (PR #169680)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 07:54:43 PDT 2026


================
@@ -100,8 +100,9 @@ static inline UnsignedOrNone getStackIndexOfNearestEnclosingCaptureReadyLambda(
     // innermost nested lambda are dependent (otherwise we wouldn't have
     // arrived here) - so we don't yet have a lambda that can capture the
     // variable.
-    if (IsCapturingVariable &&
-        VarToCapture->getDeclContext()->Equals(EnclosingDC))
+    if (IsCapturingVariable && VarToCapture->getDeclContext()
+                                   ->getEnclosingNonExpansionStatementContext()
----------------
cor3ntin wrote:

In a few places we skip over requires clause for similar reason.
Can you have an expansion in a require clause, such that we need to skip both?

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


More information about the cfe-commits mailing list