Index: clang/lib/AST/Interp/ByteCodeExprGen.h =================================================================== --- clang/lib/AST/Interp/ByteCodeExprGen.h +++ clang/lib/AST/Interp/ByteCodeExprGen.h @@ -91,6 +91,8 @@ bool VisitPointerCompoundAssignOperator(const CompoundAssignOperator *E); bool VisitExprWithCleanups(const ExprWithCleanups *E); bool VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E); + bool VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *E); + bool VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *E); bool VisitCompoundLiteralExpr(const CompoundLiteralExpr *E); bool VisitTypeTraitExpr(const TypeTraitExpr *E); bool VisitLambdaExpr(const LambdaExpr *E); Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp =================================================================== --- clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -898,6 +898,24 @@ return false; } +template +bool ByteCodeExprGen::VisitCXXBindTemporaryExpr( + const CXXBindTemporaryExpr *E) { + + return this->visit(E->getSubExpr()); +} + +template +bool ByteCodeExprGen::VisitCXXTemporaryObjectExpr( + const CXXTemporaryObjectExpr *E) { + + if (std::optional LocalIndex = + allocateLocal(E, /*IsExtended=*/false)) { + return this->visitLocalInitializer(E, *LocalIndex); + } + return false; +} + template bool ByteCodeExprGen::VisitCompoundLiteralExpr( const CompoundLiteralExpr *E) { Index: clang/test/AST/Interp/records.cpp =================================================================== --- clang/test/AST/Interp/records.cpp +++ clang/test/AST/Interp/records.cpp @@ -314,7 +314,7 @@ int Pos = 0; { - auto T = Test(Arr, Pos); + Test(Arr, Pos); // End of scope, should destroy Test. }