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 | 901e717f9295e5d9616777ad2a0c89c86ef5268d (patch) | |
| tree | 595505c5b8a67b31b766af4a91a0a04ebecea484 /clang | |
| parent | 00eace19583fe5b249d2433bb6dc9893cc90c401 (diff) | |
| download | bcm5719-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.cpp | 3 |
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; } |

