diff options
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Compiler.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index f2ce69a..f7947bd 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -3181,13 +3181,6 @@ bool Compiler<Emitter>::VisitCXXConstructExpr(const CXXConstructExpr *E) { if (T->isRecordType()) { const CXXConstructorDecl *Ctor = E->getConstructor(); - // Trivial copy/move constructor. Avoid copy. - if (Ctor->isDefaulted() && Ctor->isCopyOrMoveConstructor() && - Ctor->isTrivial() && - E->getArg(0)->isTemporaryObject(Ctx.getASTContext(), - T->getAsCXXRecordDecl())) - return this->visitInitializer(E->getArg(0)); - // If we're discarding a construct expression, we still need // to allocate a variable and call the constructor and destructor. if (DiscardResult) { @@ -3203,6 +3196,13 @@ bool Compiler<Emitter>::VisitCXXConstructExpr(const CXXConstructExpr *E) { return false; } + // Trivial copy/move constructor. Avoid copy. + if (Ctor->isDefaulted() && Ctor->isCopyOrMoveConstructor() && + Ctor->isTrivial() && + E->getArg(0)->isTemporaryObject(Ctx.getASTContext(), + T->getAsCXXRecordDecl())) + return this->visitInitializer(E->getArg(0)); + // Zero initialization. if (E->requiresZeroInitialization()) { const Record *R = getRecord(E->getType()); |