https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63764

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to jos...@codesourcery.com from comment #9)
> On Tue, 18 Nov 2014, jakub at gcc dot gnu.org wrote:
> > So, shall we convert_vector_to_pointer_for_subscript add something like
> >   if (!lvalue_p (*vecp))
> >     error_at (...); ?
> > What wording for it?
> 
> I'd think it's reasonable to subscript a non-lvalue vector (including e.g. 
> the return value of a function with vector return type) - this might of 
> course need to create a temporary object, as with non-lvalue arrays.

For rhs yes, supposedly.  But not for lhs.  So, perhaps if *vecp is not an
lvalue, assign to temporary and take address of that, but then in the end wrap
the result of the subscripting into NON_LVALUE_EXPR, so that we actually error
out on the testcase?

Reply via email to