https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128335
uecker at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from uecker at gcc dot gnu.org ---
Actually, I think this is invalid code. The type is the previously declared
type is "unsigned int". Only during the construction of the previous
declaration that type is temporarily "int", but this is not the case in the
redeclaration.
enum E { A = 1, B = _Generic(A, int: -1U) };
static_assert(_Generic(A, unsigned int: true));
enum E { A = 1, B = _Generic(A, unsigned int: -1U) };
https://godbolt.org/z/vGe8nY5zn
So I would say this is correct as implemented.