[cfe-dev] Question about arrays in blocks
Adler, Arik
arik.adler at intel.com
Wed Jun 19 02:53:03 PDT 2013
I am now testing blocks usage in OpenCL.
I noticed that Clang forbids using an arrays within blocks (Clang forbid array capturing)
For Example, the following code will fail to compile because there is a reference to an array within a block.
But if the line referring to block will comment out and the line with reference to integer pointer ('j') will comment in, the code will pass.
void block_arr()
{
int res = 0;
int i[4] = { 3, 4, 4, 1 };
int* j = i;
int (^test_block )(int) = ^(int num)
{
return num + i[1]; // This is an error: "error: cannot refer to declaration with an array type inside block"
// return num + j[1]; // This would work
};
res = test_block(7);
}
Do you know what is the reason behind this limitation?
And why it is possible to use a regular pointers but arrays are forbidden?
Thanks,
Arik
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130619/5e76e1a1/attachment.html>
More information about the cfe-dev
mailing list