aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-01-20 22:54:38 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-01-20 22:54:38 +0000
commitb351a7daad4bcac7716d52aa0044a6b7c323ad0d (patch)
treedef17a7ad3fbed68fc4947c8756f9234ee6e348a /lib/Sema/SemaOverload.cpp
parentf55254472e496340cbb4f0a24cff398e441475b5 (diff)
In objective-c++ land, a block pointer is another object pointer.
So, casting a generic object pointer ('id' or 'Class') to the block pointer is allowed. Fixes radar 7562285. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 3b6cf89306..e9b6072adc 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -1141,8 +1141,16 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
QualType ToPointeeType;
if (const PointerType *ToCPtr = ToType->getAs<PointerType>())
ToPointeeType = ToCPtr->getPointeeType();
- else if (const BlockPointerType *ToBlockPtr = ToType->getAs<BlockPointerType>())
+ else if (const BlockPointerType *ToBlockPtr =
+ ToType->getAs<BlockPointerType>()) {
+ // Objective C++: We're able to convert from a pointer to an any object
+ // to a block pointer type.
+ if (FromObjCPtr && FromObjCPtr->isObjCBuiltinType()) {
+ ConvertedType = ToType;
+ return true;
+ }
ToPointeeType = ToBlockPtr->getPointeeType();
+ }
else
return false;