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

jahanian fjahanian at apple.com
Mon Jun 9 14:56:58 PDT 2014


On May 30, 2014, at 11:57 AM, jahanian <fjahanian at apple.com> wrote:

> 
> On May 30, 2014, at 11:41 AM, 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)];
> 
> We should run this by the Foundation people. For example, this also returns 1:
> BOOL res = [b respondsToSelector:@selector(dealloc)];
> But dealloc is not a method of NSObject protocol. But it is a method
> of NSObject class. It seems more and more that we should make an exception
> for NSObject as block implements its protocol and class.

Rules are relaxed  to allow certain conversions in r210491.

- Fariborz

> 
> - Fariborz
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140609/fbac275b/attachment.html>


More information about the cfe-commits mailing list