[cfe-dev] OpenCL vector initialization

Alberto Magni alberto.magni86 at gmail.com
Tue May 31 08:10:27 PDT 2011


Hi Everybody,

The OpenCL standard allows the initialization of vector literals as follows:

typedef __attribute__ ((ext_vector_type(4))) int int4;
uint4 u = (uint4)(1);  // u will be (1, 1, 1, 1)

refer to section 6.1.6 of the OpenCL manual.

clang instead forbids this kind of initialization:
error: too few elements in vector initialization (expected 4 elements, have 1)

The attached patch tries to solve the problem.
Do you agree with my solution ?

Alberto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: single_element_compound_stmt.patch
Type: text/x-patch
Size: 1457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110531/abce34d9/attachment.bin>


More information about the cfe-dev mailing list