On Sat, 26 Aug 2023, Martin Uecker via Gcc-patches wrote: > Allow redefinition of enum types and enumerators. > > gcc/c: > * c-decl.cc (start_num): Allow redefinition.
start_enum not start_num. > @@ -9606,9 +9624,15 @@ start_enum (location_t loc, struct c_enum_contents > *the_enum, tree name, > if (name != NULL_TREE) > enumtype = lookup_tag (ENUMERAL_TYPE, name, true, &enumloc); > > + if (flag_isoc2x && enumtype != NULL_TREE > + && TREE_CODE (enumtype) == ENUMERAL_TYPE > + && TYPE_VALUES (enumtype) != NULL_TREE) > + enumtype = NULL_TREE; Much the same comment applies as on the struct/union patch regarding ensuring nested redefinitions are detected when there's a previous definition outside the two nested definitions, in addition to the point there about making sure that a definition nested inside an enum type specifier for another definition of the same enum gets detected. -- Joseph S. Myers jos...@codesourcery.com