aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 4aa8045..373972e 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -15672,12 +15672,14 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx,
// this doesn't escape.
MaterializeTemporaryExpr BaseMTE(T, const_cast<Expr*>(this), true);
APValue::LValueBase Base(&BaseMTE);
-
Info.setEvaluatingDecl(Base, Result.Val);
- LValue LVal;
- LVal.set(Base);
- {
+ if (Info.EnableNewConstInterp) {
+ if (!Info.Ctx.getInterpContext().evaluateAsRValue(Info, this, Result.Val))
+ return false;
+ } else {
+ LValue LVal;
+ LVal.set(Base);
// C++23 [intro.execution]/p5
// A full-expression is [...] a constant-expression
// So we need to make sure temporary objects are destroyed after having
@@ -15686,10 +15688,10 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx,
if (!::EvaluateInPlace(Result.Val, Info, LVal, this) ||
Result.HasSideEffects || !Scope.destroy())
return false;
- }
- if (!Info.discardCleanups())
- llvm_unreachable("Unhandled cleanup; missing full expression marker?");
+ if (!Info.discardCleanups())
+ llvm_unreachable("Unhandled cleanup; missing full expression marker?");
+ }
if (!CheckConstantExpression(Info, getExprLoc(), getStorageType(Ctx, this),
Result.Val, Kind))