From e4151b590ef4bc792f77ef912e57a8c9c0d1b81d Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Sat, 21 Aug 2010 00:10:36 +0000 Subject: patch to support comparison involving objctive-c pointer conversions. Fixes pr7936. llvm-svn: 111699 --- clang/lib/Sema/SemaOverload.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'clang/lib/Sema/SemaOverload.cpp') diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 78014a781ec..6108d5261e6 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -4168,11 +4168,18 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty, // Insert this type. if (!PointerTypes.insert(Ty)) return false; - + + QualType PointeeTy; const PointerType *PointerTy = Ty->getAs(); - assert(PointerTy && "type was not a pointer type!"); - - QualType PointeeTy = PointerTy->getPointeeType(); + if (!PointerTy) { + if (const ObjCObjectPointerType *PTy = Ty->getAs()) + PointeeTy = PTy->getPointeeType(); + else + assert(false && "type was not a pointer type!"); + } + else + PointeeTy = PointerTy->getPointeeType(); + // Don't add qualified variants of arrays. For one, they're not allowed // (the qualifier would sink to the element type), and for another, the // only overload situation where it matters is subscript or pointer +- int, @@ -4268,8 +4275,9 @@ BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty, // If we're dealing with an array type, decay to the pointer. if (Ty->isArrayType()) Ty = SemaRef.Context.getArrayDecayedType(Ty); - - if (Ty->getAs()) { + if (Ty->isObjCIdType() || Ty->isObjCClassType()) + PointerTypes.insert(Ty); + else if (Ty->getAs() || Ty->getAs()) { // Insert our type, and its more-qualified variants, into the set // of types. if (!AddPointerWithMoreQualifiedTypeVariants(Ty, VisibleQuals)) -- cgit v1.2.3