[cfe-commits] r122363 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaTemplate/instantiate-local-class.cpp
Douglas Gregor
dgregor at apple.com
Tue Dec 21 13:40:41 PST 2010
Author: dgregor
Date: Tue Dec 21 15:40:41 2010
New Revision: 122363
URL: http://llvm.org/viewvc/llvm-project?rev=122363&view=rev
Log:
For member pointer conversions potentially involving derived-to-base
conversions, make sure that the (possibly) derived type is complete
before looking for base classes.
Finishes the fix for PR8801.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaTemplate/instantiate-local-class.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=122363&r1=122362&r2=122363&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Dec 21 15:40:41 2010
@@ -1883,9 +1883,10 @@
// where D is derived from B (C++ 4.11p2).
QualType FromClass(FromTypePtr->getClass(), 0);
QualType ToClass(ToTypePtr->getClass(), 0);
- // FIXME: What happens when these are dependent? Is this function even called?
- if (IsDerivedFrom(ToClass, FromClass)) {
+ if (!Context.hasSameUnqualifiedType(FromClass, ToClass) &&
+ !RequireCompleteType(From->getLocStart(), ToClass, PDiag()) &&
+ IsDerivedFrom(ToClass, FromClass)) {
ConvertedType = Context.getMemberPointerType(FromTypePtr->getPointeeType(),
ToClass.getTypePtr());
return true;
Modified: cfe/trunk/test/SemaTemplate/instantiate-local-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-local-class.cpp?rev=122363&r1=122362&r2=122363&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-local-class.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-local-class.cpp Tue Dec 21 15:40:41 2010
@@ -55,11 +55,13 @@
template<typename T>
void foo() {
class X;
- int (X::*pmf)(T) = 0;
+ typedef int (X::*pmf_type)();
class X : public T { };
+
+ pmf_type pmf = &T::foo;
}
- struct Y { };
+ struct Y { int foo(); };
template void foo<Y>();
}
More information about the cfe-commits
mailing list