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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase:

struct S { int s; };

void
foo (void)
{
  void *p = &(struct S) { 0 };
  void *q = &({ (struct S) { 0 }; });
}

The p initializer is accepted, q is rejected.
By my reading this is invalid, C99 6.5.2.5/6 says:
"If the compound literal occurs outside the body of a function, the object
has static storage duration; otherwise, it has automatic storage duration
associated with the enclosing block."
and the statement expression is still a compound statement and thus the
compound literal is associated with the statement expression's block.  So it is
the same thing as:
void
bar (void)
{
  void *r = &({ int a = 0; a; });
}
which fails with the same diagnostics.

Joseph, do you agree?

Reply via email to