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

Peter Collingbourne peter at pcc.me.uk
Wed Sep 21 07:30:04 PDT 2011


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.

Thanks,
-- 
Peter



More information about the cfe-dev mailing list