r209906 - Objective-C. Diagnose assigning a block pointer type to

Jordan Rose jordan_rose at apple.com
Fri May 30 11:49:35 PDT 2014


On May 30, 2014, at 11:41 , Argyrios Kyrtzidis <kyrtzidis at apple.com> wrote:

>> 
>> On May 30, 2014, at 11:34 AM, Argyrios Kyrtzidis <kyrtzidis at apple.com> wrote:
>> 
>> 
>>> On May 30, 2014, at 11:13 AM, jahanian <fjahanian at apple.com> wrote:
>>> 
>>> Is this intentional, or a specific case for retain/release methods?
>> 
>> This also returns TRUE:
>> 
>> 	blk b = ^{};
>> 	BOOL res = [b respondsToSelector:@selector(isKindOfClass:)];
>> 
>> So blocks seem to respond to NSObject protocol selectors.
>> 
>>> In generally though it makes no sense
>>> to allow qualified id conversion of blocks pointers.
>> 
>> It would make sense for id<NSObject> if we would guarantee that blocks conform to NSObject protocol.
> 
> BTW, returns true as well:
> 
> 	blk b = ^{};
> 	BOOL res = [b conformsToProtocol:@protocol(NSObject)];


And for a long time this also returned true:

[[NSArray array] isKindOfClass:[NSMutableArray class]];

Just because the current implementation provides this functionality doesn't mean it's something that people should be using.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140530/1d16997f/attachment.html>


More information about the cfe-commits mailing list