================
@@ -17693,12 +17691,13 @@ void Sema::PopExpressionEvaluationContext() {
 
   // Append the collected materialized temporaries into previous context before
   // exit if the previous also is a lifetime extending context.
-  auto &PrevRecord = ExprEvalContexts[ExprEvalContexts.size() - 2];
+  auto &PrevRecord = parentEvaluationContext();
   if (getLangOpts().CPlusPlus23 && Rec.InLifetimeExtendingContext &&
       PrevRecord.InLifetimeExtendingContext &&
       !Rec.ForRangeLifetimeExtendTemps.empty()) {
-    PrevRecord.ForRangeLifetimeExtendTemps.append(
-        Rec.ForRangeLifetimeExtendTemps);
+    const_cast<SmallVector<MaterializeTemporaryExpr *, 8> &>(
----------------
Endilll wrote:

For the context, our overall const-correctness situation in Sema is less than 
ideal, to put it mildly. In this particular case I think we need to add a 
non-const overload for `parentEvaluationContext()` with the following 
prototype: `ExpressionEvaluationContextRecord &parentEvaluationContext()`.

https://github.com/llvm/llvm-project/pull/93338
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to