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

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 15:51:55 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()
----------------
shafik wrote:

I see you have throw these (`getEnclosingNonExpansionStatementContext`) in a bunch of places and it is not clear to me how we can ensure we did not miss spots that could blow up later on.

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


More information about the cfe-commits mailing list