[clang] [Clang] [C++26] Iterating expansion statements using string injection (PR #208877)

Ambrose Leeb via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 10:20:28 PDT 2026


================
@@ -620,11 +645,35 @@ Sema::ComputeExpansionSize(CXXExpansionStmtPattern *Expansion) {
     EnterExpressionEvaluationContext ExprEvalCtx(
         *this, ExpressionEvaluationContext::ConstantEvaluated);
 
-    // TODO: Build the lambda and evaluate it.
-    Diag(Loc, diag::err_iterating_expansion_stmt_unsupported);
-    return std::nullopt;
+    // Annotation token that instructs the parser to declare begin/end, i.e.
+    //
+    //   auto __begin = begin-expr;
+    //   auto __end = end-expr;
+    //
+    Token DeclareBeginEnd;
+    DeclareBeginEnd.startToken();
----------------
Sirraide wrote:

Yes, I agree calling `startToken()` manually is a bit sad; I’ll see if I can dd a function for that, though that should probably be a separate NFC patch

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


More information about the cfe-commits mailing list