================
@@ -620,11 +645,34 @@ 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.
+    Token DeclareBeginEnd;
+    DeclareBeginEnd.startToken();
+    DeclareBeginEnd.setKind(tok::annot_expansion_stmt_declare_begin_end);
+    DeclareBeginEnd.setAnnotationValue(Expansion->getRangeVar());
+    DeclareBeginEnd.setLocation(Loc);
+    DeclareBeginEnd.setAnnotationEndLoc(Loc);
+
+    // Build the lambda.
+    ExprResult Call = TokenInjectionHandler->ParseAsExpression(
+        R"c++(
+        [&] consteval {
+           __PTRDIFF_TYPE__ __result = 0;
+           // Note: The next line is equivalent to:
+           // auto __begin = begin-expr;
+           // auto __end = end-expr;
----------------
cor3ntin wrote:

I don't think that comment here is helping anyone - maybe move it outside of 
the injected code

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

Reply via email to