aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-12-22 20:51:52 +0000
committerDouglas Gregor <dgregor@apple.com>2008-12-22 20:51:52 +0000
commit27b09ac9f7a4b2555bb9adda3568f3ba6264a63e (patch)
tree910ac3e09d35687fb9c444b28ed1d86b0dcbfb32 /lib/Sema/SemaOverload.cpp
parent669e8d3c6a89c1ff45500d36dde7011b3cf7af7c (diff)
Support conversion from a null pointer constant o any Objective-C object pointer type. Fixes rdar://problem/6463298
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 5fb1b14b98..8365349513 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -767,6 +767,13 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
if (isObjCPointerConversion(FromType, ToType, ConvertedType, IncompatibleObjC))
return true;
+ // Conversion from a null pointer constant to any Objective-C pointer type.
+ if (Context.isObjCObjectPointerType(ToType) &&
+ From->isNullPointerConstant(Context)) {
+ ConvertedType = ToType;
+ return true;
+ }
+
// Blocks: Block pointers can be converted to void*.
if (FromType->isBlockPointerType() && ToType->isPointerType() &&
ToType->getAsPointerType()->getPointeeType()->isVoidType()) {