https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69023
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
I'm not sure. I did read the relevant text in the C++ and C standards and I
can't say I see a clear answer. But then it rarely seems to be in these corner
cases.
GCC (in C mode) accepts the code. All other C and C++ compilers I have access
to (about half a dozen) do as well. The one interesting thing I noticed that
the EDG front end issues the following warnings in C89 and C++ modes but not in
C99 and later.
"b.c", line 4: warning: reference to local variable of enclosing function is
not allowed
struct { int : sizeof x; } b0; (void)&b0;
^
"b.c", line 5: warning: reference to local variable of enclosing function is
not allowed
struct { int x: sizeof x; } b1; (void)&b1;
^