diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-21 18:30:38 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-21 18:30:38 +0000 |
commit | 12116062c8243c6f88d79dac9663a359b77741c6 (patch) | |
tree | 9770cb5d561975211fd273d93d92652d5906cdb3 /lib/Sema/SemaOverload.cpp | |
parent | c144f3534e2f7a70ea9ebf8dd83090a2883d61fb (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96742 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index b79b1cc993..1c6fd17c38 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -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; } |