diff options
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Compiler.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index d1c93e4..51c234d 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -2886,7 +2886,20 @@ bool Compiler<Emitter>::VisitMaterializeTemporaryExpr( template <class Emitter> bool Compiler<Emitter>::VisitCXXBindTemporaryExpr( const CXXBindTemporaryExpr *E) { - return this->delegate(E->getSubExpr()); + const Expr *SubExpr = E->getSubExpr(); + + if (Initializing) + return this->delegate(SubExpr); + + // Make sure we create a temporary even if we're discarding, since that will + // make sure we will also call the destructor. + + if (!this->visit(SubExpr)) + return false; + + if (DiscardResult) + return this->emitPopPtr(E); + return true; } template <class Emitter> |