[cfe-commits] r96787 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CXX/temp/temp.spec/temp.explicit/p6.cpp

Douglas Gregor dgregor at apple.com
Mon Feb 22 09:06:41 PST 2010


Author: dgregor
Date: Mon Feb 22 11:06:41 2010
New Revision: 96787

URL: http://llvm.org/viewvc/llvm-project?rev=96787&view=rev
Log:
Do not require a complete type when checking for a pointer conversion
between cv1 T* and cv2 T*.

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=96787&r1=96786&r2=96787&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Feb 22 11:06:41 2010
@@ -1094,6 +1094,7 @@
   // here. That is handled by CheckPointerConversion.
   if (getLangOptions().CPlusPlus &&
       FromPointeeType->isRecordType() && ToPointeeType->isRecordType() &&
+      !Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType) &&
       !RequireCompleteType(From->getLocStart(), FromPointeeType, PDiag()) &&
       IsDerivedFrom(FromPointeeType, ToPointeeType)) {
     ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,

Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp?rev=96787&r1=96786&r2=96787&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp Mon Feb 22 11:06:41 2010
@@ -12,3 +12,24 @@
 
 template void f0<int>(int, float*);
 template void f0<>(double, float*);
+
+template<typename T> struct hash { };
+struct S {
+  bool operator==(const S&) const { return false; }
+};
+
+template<typename T> struct Hash_map {
+  void Method(const T& x) { h(x); }
+  hash<T> h;
+};
+
+Hash_map<S> *x;
+const Hash_map<S> *foo() {
+  return x;
+}
+
+template<> struct hash<S> {
+  int operator()(const S& k) const {
+    return 0;
+  }
+};





More information about the cfe-commits mailing list