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

--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Wed, 9 Jan 2019, msebor at gcc dot gnu.org wrote:

> I don't disagree with the conclusion about the validity of this test case but
> there are examples where GCC does treat a statement expression as an lvalue,
> such as in the following:
> 
>   void f (void)
>   { 
>     int i = 0;
>     ++__extension__({ (int)i; });   // accepted
>     if (i != 1)                     // folded to false
>       __builtin_abort ();
>   }
> 
> Accepting this seems like a bug irrespective of whether statement expressions
> themselves are ever lvalues.

Indeed.  Casts as lvalues were removed a very long time ago.

> GCC of course also accepts ++({ i; }).  Joseph's comment #2 suggests this
> should be invalid as well but I might be reading too much into it.  In any
> case, it would be helpful to make this clear in the manual.

I think ++({ i; }) should be invalid.  (If i is an _Atomic int, it's 
already rejected because of the special lvalue-to-rvalue processing 
applied for atomics.)

Reply via email to