[cfe-commits] r96742 - /cfe/trunk/lib/Sema/SemaOverload.cpp
Douglas Gregor
dgregor at apple.com
Sun Feb 21 10:30:39 PST 2010
Author: dgregor
Date: Sun Feb 21 12:30:38 2010
New Revision: 96742
URL: http://llvm.org/viewvc/llvm-project?rev=96742&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=96742&r1=96741&r2=96742&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sun Feb 21 12:30:38 2010
@@ -2439,7 +2439,8 @@
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;
}
More information about the cfe-commits
mailing list