зеркало из https://github.com/microsoft/clang-1.git
When building a cast argument, make sure to bind the result to a temporary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84448 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
01eb9b9683
Коммит
4fa26848ac
|
@ -2202,9 +2202,14 @@ Sema::OwningExprResult Sema::BuildCXXCastArgument(SourceLocation CastLoc,
|
|||
MultiExprArg(*this, (void **)&From, 1),
|
||||
CastLoc, ConstructorArgs))
|
||||
return ExprError();
|
||||
|
||||
return BuildCXXConstructExpr(CastLoc, Ty, cast<CXXConstructorDecl>(Method),
|
||||
move_arg(ConstructorArgs));
|
||||
|
||||
OwningExprResult Result =
|
||||
BuildCXXConstructExpr(CastLoc, Ty, cast<CXXConstructorDecl>(Method),
|
||||
move_arg(ConstructorArgs));
|
||||
if (Result.isInvalid())
|
||||
return ExprError();
|
||||
|
||||
return MaybeBindToTemporary(Result.takeAs<Expr>());
|
||||
}
|
||||
|
||||
case CastExpr::CK_UserDefinedConversion: {
|
||||
|
@ -2216,7 +2221,7 @@ Sema::OwningExprResult Sema::BuildCXXCastArgument(SourceLocation CastLoc,
|
|||
|
||||
// Create an implicit call expr that calls it.
|
||||
CXXMemberCallExpr *CE = BuildCXXMemberCallExpr(From, Method);
|
||||
return Owned(CE);
|
||||
return MaybeBindToTemporary(CE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,3 +93,25 @@ void f6() {
|
|||
F().f();
|
||||
}
|
||||
|
||||
struct G {
|
||||
G();
|
||||
G(A);
|
||||
~G();
|
||||
operator A();
|
||||
};
|
||||
|
||||
void a(const A&);
|
||||
|
||||
void f7() {
|
||||
// CHECK: call void @_ZN1AC1Ev
|
||||
// CHECK: call void @_Z1aRK1A
|
||||
// CHECK: call void @_ZN1AD1Ev
|
||||
a(A());
|
||||
|
||||
// CHECK: call void @_ZN1GC1Ev
|
||||
// CHECK: call void @_ZN1Gcv1AEv
|
||||
// CHECK: call void @_Z1aRK1A
|
||||
// CHECK: call void @_ZN1AD1Ev
|
||||
// CHECK: call void @_ZN1GD1Ev
|
||||
a(G());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче