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: {
// Create an implicit call expr that calls it.
CXXMemberCallExpr *CE = BuildCXXMemberCallExpr(From, Method);
- return Owned(CE);
+ return MaybeBindToTemporary(CE);
}
}
}
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());
+}