diff options
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/rvalue-references.cpp | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 78d9a5b959..5da10352cc 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -5551,7 +5551,7 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, // can be omitted by constructing the temporary object // directly into the target of the omitted copy/move if (ConstructKind == CXXConstructExpr::CK_Complete && - Constructor->isCopyConstructor() && ExprArgs.size() >= 1) { + Constructor->isCopyOrMoveConstructor() && ExprArgs.size() >= 1) { Expr *SubExpr = ((Expr **)ExprArgs.get())[0]; Elidable = SubExpr->isTemporaryObject(Context, Constructor->getParent()); } diff --git a/test/CodeGenCXX/rvalue-references.cpp b/test/CodeGenCXX/rvalue-references.cpp index a7c74ae5c0..e15172355e 100644 --- a/test/CodeGenCXX/rvalue-references.cpp +++ b/test/CodeGenCXX/rvalue-references.cpp @@ -62,13 +62,10 @@ C test(); // CHECK: define void @_Z15elide_copy_initv void elide_copy_init() { ok = false; - // FIXME: We're doing an extra move here, when we shouldn't be! - // CHECK: call void @_Z4testv(%class.C* sret %ref.tmp) - // CHECK: call void @_ZN1CC1EOS_(%class.C* %a, %class.C* %ref.tmp) - // CHECK: call void @_ZN1CD1Ev(%class.C* %ref.tmp) + // CHECK: call void @_Z4testv C a = test(); - // CHECK: call void @_ZN1CD1Ev(%class.C* %a) - // CHECK: ret void + // CHECK-NEXT: call void @_ZN1CD1Ev + // CHECK-NEXT: ret void } // CHECK: define void @_Z16test_move_returnv |