summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-21 18:30:38 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-21 18:30:38 +0000
commit901e717f9295e5d9616777ad2a0c89c86ef5268d (patch)
tree595505c5b8a67b31b766af4a91a0a04ebecea484 /clang
parent00eace19583fe5b249d2433bb6dc9893cc90c401 (diff)
downloadbcm5719-llvm-901e717f9295e5d9616777ad2a0c89c86ef5268d.tar.gz
bcm5719-llvm-901e717f9295e5d9616777ad2a0c89c86ef5268d.zip
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
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index b79b1cc9937..1c6fd17c381 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud