switch (Kind) {
default: llvm_unreachable("Unhandled cast kind!");
case CK_ConstructorConversion: {
+ CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(Method);
ASTOwningVector<Expr*> ConstructorArgs(S);
- if (S.CompleteConstructorCall(cast<CXXConstructorDecl>(Method),
+ if (S.CompleteConstructorCall(Constructor,
MultiExprArg(&From, 1),
CastLoc, ConstructorArgs))
return ExprError();
- ExprResult Result =
- S.BuildCXXConstructExpr(CastLoc, Ty, cast<CXXConstructorDecl>(Method),
- move_arg(ConstructorArgs), HadMultipleCandidates,
- /*ZeroInit*/ false, CXXConstructExpr::CK_Complete,
- SourceRange());
+ S.CheckConstructorAccess(CastLoc, Constructor, Constructor->getAccess(),
+ S.PDiag(diag::err_access_ctor));
+
+ ExprResult Result
+ = S.BuildCXXConstructExpr(CastLoc, Ty, cast<CXXConstructorDecl>(Method),
+ move_arg(ConstructorArgs),
+ HadMultipleCandidates, /*ZeroInit*/ false,
+ CXXConstructExpr::CK_Complete, SourceRange());
if (Result.isInvalid())
return ExprError();
void g(X2 b) {
int &ir = f(b); // expected-error{{no viable constructor copying parameter of type 'X1'}}
}
+
+namespace rdar10202900 {
+ class A {
+ public:
+ A();
+
+ private:
+ A(int i); // expected-note{{declared private here}}
+ };
+
+ void testA(A a) {
+ int b = 10;
+ a = b; // expected-error{{calling a private constructor of class 'rdar10202900::A'}}
+ }
+}