A constructor template cannot be used to copy to an object of the same class type (per C++ [class.copy]p3). Make sure that includes copies that involve a derived-to-base conversion. Fixes PR6141.

llvm-svn: 96742
This commit is contained in:
Douglas Gregor 2010-02-21 18:30:38 +00:00
parent 00eace1958
commit 901e717f92
1 changed files with 2 additions and 1 deletions

View File

@ -2439,7 +2439,8 @@ Sema::AddOverloadCandidate(FunctionDecl *Function,
QualType ClassType = Context.getTypeDeclType(Constructor->getParent());
if (NumArgs == 1 &&
Constructor->isCopyConstructorLikeSpecialization() &&
Context.hasSameUnqualifiedType(ClassType, Args[0]->getType()))
(Context.hasSameUnqualifiedType(ClassType, Args[0]->getType()) ||
IsDerivedFrom(Args[0]->getType(), ClassType)))
return;
}