[cfe-dev] [OpenCL patch] Vector literals are rvalues *updated*

Anton Lokhmotov Anton.Lokhmotov at arm.com
Fri Sep 23 08:55:30 PDT 2011


Many thanks for prompt reviews!

On Sep 21, 2011, at 7:30 AM, Peter Collingbourne wrote:

> What about compound literals which are not of vector type?  
> The OpenCL specification is silent on these, which means we 
> should defer to C99, which states that they are lvalues.

I personally think it's a sad omission, because I can't imagine why one
would want to take the address of a compound literal of any type (e.g. C++
forbids it).

On Sep 21, 2011, at 10:01 AM, John McCall wrote:
> Right.  Ideally, this should just apply to OpenCL vector literals,
> i.e. this should be an r-value:
>   (int4) (3,2,1,0)
> and this should be an l-value:
>   (int4) {3,2,1,0}

On 22 September 2011 00:57, Tanya Lattner wrote:
> Agreed. If you can have it apply only for OpenCL vector literals, 
> then it looks good to me.

Unfortunately, we can't, as these two forms are indistinguishable in the
AST.  (Strictly speaking, only the first form is valid in OpenCL, but as we
discussed [1] we should permit the second one as well.)

Please review the updated patch.

Many thanks,
Anton.

[1] http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-July/016122.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: literals_p2.patch
Type: application/octet-stream
Size: 2131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110923/a3449670/attachment.obj>


More information about the cfe-dev mailing list