[cfe-dev] [OpenCL patch] Vector literals are rvalues
Tanya Lattner
lattner at apple.com
Wed Sep 21 16:57:13 PDT 2011
On Sep 21, 2011, at 10:01 AM, John McCall wrote:
>
> On Sep 21, 2011, at 7:30 AM, Peter Collingbourne wrote:
>
>> On Wed, Sep 21, 2011 at 02:16:26PM +0100, Anton Lokhmotov wrote:
>>> Clang currently accepts taking the address of a vector literal in the OpenCL
>>> mode, e.g.
>>>
>>> return &((int4)(3,2,1,0)); // expected-error{{address expression must be
>>> an lvalue}}
>>>
>>> which is wrong (http://llvm.org/bugs/show_bug.cgi?id=10966).
>>>
>>> Please review the attached patch that fixes this problem.
>>
>> Hi Anton,
>>
>> 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.
>
> 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,10}
>
Agreed. If you can have it apply only for OpenCL vector literals, then it looks good to me.
-Tanya
> John.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list