[PATCH] D29764: [OpenCL] Blocks cannot capture/reference another block
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 10 10:28:03 PST 2017
yaxunl added a comment.
In https://reviews.llvm.org/D29764#673548, @Nicola wrote:
> Looking at "Example 4" in the standard it looks like this should also be illegal.
>
> int (^block1)(void) = ^int {return 1;};
> int foo() { return block1(); }
>
> __kernel void k(global int *z)
> {
> int (^block2)(void) = ^int {
> return foo(); // expected-error {{cannot refer to a block inside block}}
> };
> }
>
>
>
> Unless I missed something it's not erroring in this case.
To diagnose this needs to traverse the AST tree. I think it is too much to do it during parsing.
It may be done through static analysis though.
https://reviews.llvm.org/D29764
More information about the cfe-commits
mailing list