aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-10-26 06:23:29 +0000
committerJohn McCall <rjmccall@apple.com>2010-10-26 06:23:29 +0000
commit6d09da00bf5b5841380eae76571798ced6697f4c (patch)
treed7bd2cbd602267c8b4c5a90763e8dc9f3d76c693 /lib/Sema/SemaOverload.cpp
parent0700bbfbccc639f093f0e2a9b2ae94a213f218b4 (diff)
Consider conversions of Objective-C pointers to 'id' to be basically of
the same rank as conversions of normal pointers to 'void*'. Also, resurrect a test case. Fixes rdar://problem/8592139 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 8f653d1df0..7244582829 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -200,6 +200,9 @@ bool StandardConversionSequence::isPointerConversionToBool() const {
/// conversion is a conversion of a pointer to a void pointer. This is
/// used as part of the ranking of standard conversion sequences (C++
/// 13.3.3.2p4).
+///
+/// Note that we treat conversions of Objective-C pointers to
+/// unqualified 'id' as having this same rank.
bool
StandardConversionSequence::
isPointerConversionToVoidPointer(ASTContext& Context) const {
@@ -212,9 +215,15 @@ isPointerConversionToVoidPointer(ASTContext& Context) const {
if (First == ICK_Array_To_Pointer)
FromType = Context.getArrayDecayedType(FromType);
- if (Second == ICK_Pointer_Conversion && FromType->isPointerType())
+ if (Second == ICK_Pointer_Conversion && FromType->isPointerType()) {
if (const PointerType* ToPtrType = ToType->getAs<PointerType>())
return ToPtrType->getPointeeType()->isVoidType();
+ } else if (Second == ICK_Pointer_Conversion &&
+ FromType->isObjCObjectPointerType()) {
+ if (const ObjCObjectPointerType *ToPtrType =
+ ToType->getAs<ObjCObjectPointerType>())
+ return ToPtrType->isObjCIdType();
+ }
return false;
}