diff options
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 3 | ||||
-rw-r--r-- | test/CodeGenCXX/temporaries.cpp | 19 |
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index a6b409b99f..a9acf72644 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3234,9 +3234,6 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, return true; Arg = ArgE.takeAs<Expr>(); - - if (!ProtoArgType->isReferenceType()) - Arg = MaybeBindToTemporary(Arg).takeAs<Expr>(); } else { ParmVarDecl *Param = FDecl->getParamDecl(i); diff --git a/test/CodeGenCXX/temporaries.cpp b/test/CodeGenCXX/temporaries.cpp index f83bbeeac8..3fd7cfec78 100644 --- a/test/CodeGenCXX/temporaries.cpp +++ b/test/CodeGenCXX/temporaries.cpp @@ -216,3 +216,22 @@ I f12() { // CHECK: ret void return "Hello"; } + +// PR5867 +namespace PR5867 { + struct S { + S(); + S(const S &); + ~S(); + }; + + void f(S, int); + // CHECK: define void @_ZN6PR58671gEv + void g() { + // CHECK: call void @_ZN6PR58671SC1Ev + // CHECK-NEXT: call void @_ZN6PR58671fENS_1SEi + // CHECK-NEXT: call void @_ZN6PR58671SD1Ev + // CHECK-NEXT: ret void + (f)(S(), 0); + } +} |