Do not require a complete type when checking for a pointer conversion

between cv1 T* and cv2 T*.

llvm-svn: 96787
This commit is contained in:
Douglas Gregor 2010-02-22 17:06:41 +00:00
parent f4f2e0247f
commit d28f0412e4
2 changed files with 22 additions and 0 deletions

View File

@ -1094,6 +1094,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
// 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,

View File

@ -12,3 +12,24 @@ template<typename T, typename U> void f0(T, U*) { }
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;
}
};