[cfe-dev] ObjC blocks documentation

fariborz jahanian via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 8 09:53:19 PST 2016


It was restricted due to performance implication of capturing the array. Earlier versions of ObjC blocks
captured the array address with this syntax. This was a source of confusion and it was decided to outright ban it.

- Fariborz

> On Mar 8, 2016, at 2:30 AM, Anastasia Stulova via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> Hi,
>  
> It seems that capturing arrays is not allowed in Clang Blocks i.e. the following code:
>  
>   int arr[10];
>  
>   int* (^bl)() = ^ int*() {return arr;};
>  
> fails with:
>  
>   error: cannot refer to declaration with an array type inside block
>  
> I have checked the documentation on Blocks in Clang  and some ObjC manual but can’t find anything related to it.
> Also the Clang commit history doesn’t provide much information.
>  
> Does anyone know why is this restricted? Or could anyone point to good documentation where such things are explained?
>  
> Thanks in advance,
> Anastasia 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160308/cfa801e0/attachment.html>


More information about the cfe-dev mailing list