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

via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 08:30:16 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()
----------------
Sirraide wrote:

I don’t think so; requires clauses can’t contain arbitrary statements afaik (unless it’s in a lambda, but in that case the enclosing decl context would be the lambda itself, which is probably what we want)

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


More information about the cfe-commits mailing list