forked from OSchip/llvm-project
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:
parent
00eace1958
commit
901e717f92
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue