On Sun, Nov 11, 2018 at 9:10 PM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > > > On Sun, Nov 11 2018, Jeff King wrote: > > > On Sat, Nov 10, 2018 at 10:23:05PM -0800, Elijah Newren wrote: > > > >> ABORT and ERROR happen to have the same value, but come from differnt > >> enums. Use the one from the correct enum. > > > > Yikes. :) > > > > This is a good argument for naming these SIGNED_TAG_ABORT, etc. But this > > is obviously an improvement in the meantime. > > In C enum values aren't the types of the enum, but I'd thought someone > would have added a warning for this: > > #include <stdio.h> > > enum { A, B } foo = A; > enum { C, D } bar = C; > > int main(void) > { > switch (foo) { > case C: > puts("A"); > break; > case B: > puts("B"); > break; > } > } > > But none of the 4 C compilers (gcc, clang, suncc & xlc) I have warn > about it. Good to know. Asked GCC to implement it: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87983