diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 4f61f87b0fd24..c6c4c787e5d84 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1610,7 +1610,6 @@ bool ByteCodeExprGen::visitExpr(const Expr *Exp) { template bool ByteCodeExprGen::visitDecl(const VarDecl *VD) { assert(!VD->isInvalidDecl() && "Trying to constant evaluate an invalid decl"); - std::optional VarT = classify(VD->getType()); // Create and initialize the variable. if (!this->visitVarDecl(VD)) @@ -1630,7 +1629,7 @@ bool ByteCodeExprGen::visitDecl(const VarDecl *VD) { } // Return the value - if (VarT) { + if (std::optional VarT = classify(VD->getType())) { if (!this->emitLoadPop(*VarT, VD)) return false;