On Thu, 16 Nov 2023, Martin Uecker wrote: > +enum tt { R = 2 } TT; > +enum tt { > + R = _Generic(&TT, enum tt*: 0, default: 2) > +};
> +// incomplete during construction > + > +enum A { B = 7 } y; > +enum A { B = 7 }; > + > +enum A { B = _Generic(&y, enum A*: 1, default: 7) }; I don't follow the basis for these examples. The multiple definitions are in the same scope, so declare the same type. The type "is incomplete until immediately after the closing brace of the list defining the content for the first time and complete thereafter.", which should include being complete inside the redefinition (so avoiding the problems discussed in earlier drafts of the proposal when a type went from complete to incomplete and there were corresponding issues with type compatibility questions inside the redefinition). So I'd expect the "enum tt*" and "enum A*" cases in _Generic to match (which would make these definitions invalid because of the enumeration constant getting a different type). > +void g(void) > +{ > + enum A { B = _Generic(&y, enum A*: 1, default: 7) }; In this case with an inner scope, however, "enum A" refers to the new type which indeed is incomplete at this point - though that also means this isn't an ISO C example but one using a GNU C extension ("A type specifier of the form enum identifier without an enumerator list shall only appear after the type it specifies is complete.") and so should correspondingly be in a gnu23-* test. -- Joseph S. Myers jos...@codesourcery.com