https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16186
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- FWIW, Clang implements this warning: $ xclang++ -c -xc j.c -Wduplicate-enum j.c:1:33: warning: element 'foo' has been implicitly assigned 0 which another element has been assigned [-Wduplicate-enum] enum status { ok = 0, err = -1, foo, bar }; ^~~ j.c:1:15: note: element 'ok' also has value 0 enum status { ok = 0, err = -1, foo, bar }; ^~~~~~ I suppose we could do a binary search when adding a new enumerator in build_enumerator, see if an enumerator with the same value is already present, and warn if so.