https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116631
Harald van Dijk <harald at gigawatt dot nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |harald at gigawatt dot nl
--- Comment #4 from Harald van Dijk <harald at gigawatt dot nl> ---
Note that although the standard's restriction is on structure member's names,
that is not what GCC implements. If GCC merely implemented that, it would
accept
auto a = ( sizeof (struct {}), 2 );
which is non-standard but using a documented and supported GCC extension (empty
structures), violating no other rule in either the C standard or GCC's
documentation, yet is still rejected: it causes the same error
error: 'struct <anonymous>' defined in underspecified object initializer
The error makes sense, but is a mismatch between documentation and
implementation.
I have no opinion on whether the error should be removed (both for the original
example and this modified one), except that if this is kept an error, I would
ask for the documentation to be updated to match.