https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116892
--- Comment #11 from uecker at gcc dot gnu.org --- (In reply to Richard Earnshaw from comment #10) > (In reply to uecker from comment #9) > > (In reply to Richard Earnshaw from comment #8) > > > Forward declarations of enums in C requires c23, when you can use the size > > > type specifier. For earlier versions this isn't valid code. > > > > Is is a GNU extension: > > https://gcc.gnu.org/onlinedocs/gcc/Enum-Extensions.html > > <quote> > GCC has also traditionally supported forward declarations of enum types that > don’t include an explicit underlying type specification. This results in an > incomplete type, much like what you get if you write struct foo without > describing the elements. > > <em>You cannot allocate variables or storage using the type while it is > incomplete. </em> > > However, you can work with pointers to that type. > </quote> > > So a prototype passing/returning a value is essentially defining the amount > of storage the parameter would need for passing (to allow for sizing the > parameter list). That falls under the unsupported cases in situations like > #c2. A prototype with an incomplete type is fine, but you can not call it before it is completed. https://godbolt.org/z/4Meznhfdj