[cfe-dev] OpenCL patch: vector literals (alternative patch)

John McCall rjmccall at apple.com
Wed Jul 13 11:19:05 PDT 2011

On Jul 13, 2011, at 11:14 AM, Anton Lokhmotov wrote:
> John McCall wrote:
>> So this should be legal if C99 is an acceptable base language for
>> OpenCL and the following is valid:
>>  uchar4 vec = { x.lo };
> OpenCL is a superset of a subset of C99, so the fist condition is met.
> However, section 6.1.6 of the OpenCL specification says that only
> (typen)(...) is valid syntax for initializing vector literals, not {...}.

I read this section as specifying a new kind of expression, the OpenCL
vector literal, rather than prohibiting forming a vector in other ways.
The standard doesn't lay down rules for initializing vectors as
aggregates, but as you say, we clearly already permit it and should
not go back on it.

I'll let Tanya review the merged patch.


More information about the cfe-dev mailing list