https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63764
--- Comment #11 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- On Tue, 18 Nov 2014, jakub at gcc dot gnu.org wrote: > > 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? Yes, that sort of thing - make the result of subscripting not an lvalue if the expression subscripted is not an lvalue, so that an error results on assigning to it.