[cfe-commits] r85532 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaTemplate/instantiate-cast.cpp
Douglas Gregor
dgregor at apple.com
Thu Oct 29 16:08:22 PDT 2009
Author: dgregor
Date: Thu Oct 29 18:08:22 2009
New Revision: 85532
URL: http://llvm.org/viewvc/llvm-project?rev=85532&view=rev
Log:
We may need to instantiate a class template specialization as part of a derived-to-base pointer case
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaTemplate/instantiate-cast.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=85532&r1=85531&r2=85532&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Oct 29 18:08:22 2009
@@ -999,6 +999,7 @@
// here. That is handled by CheckPointerConversion.
if (getLangOptions().CPlusPlus &&
FromPointeeType->isRecordType() && ToPointeeType->isRecordType() &&
+ !RequireCompleteType(From->getLocStart(), FromPointeeType, PDiag()) &&
IsDerivedFrom(FromPointeeType, ToPointeeType)) {
ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
ToPointeeType,
Modified: cfe/trunk/test/SemaTemplate/instantiate-cast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-cast.cpp?rev=85532&r1=85531&r2=85532&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-cast.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-cast.cpp Thu Oct 29 18:08:22 2009
@@ -96,7 +96,6 @@
template struct FunctionalCast1<int, float>;
template struct FunctionalCast1<A, int>; // expected-note{{instantiation}}
-#if 0
// Generates temporaries, which we cannot handle yet.
template<int N, long M>
struct FunctionalCast2 {
@@ -106,4 +105,13 @@
};
template struct FunctionalCast2<1, 3>;
-#endif
+
+// ---------------------------------------------------------------------
+// implicit casting
+// ---------------------------------------------------------------------
+template<typename T>
+struct Derived2 : public Base { };
+
+void test_derived_to_base(Base *&bp, Derived2<int> *dp) {
+ bp = dp;
+}
More information about the cfe-commits
mailing list