https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92428
--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- Each enum type is compatible with an integer type, and in GCC that's unsigned int by default (in the absence of values that don't fit in unsigned int), so it's valid to declare a function both as returning unsigned int and as returning a *complete* enum type. The problem here is probably to do with forward declarations of enum types (which are a GNU extension). If an enum type is incomplete when used, GCC can't know whether it will end up being compatible with unsigned int or not.