https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81598
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- As for the switch, I think there shouldn't be any runtime error, there is no UB. You can have default: label even if you list all the possible in-range cases, you can have enum values in between min/max that aren't in the enumeration, and you can have case labels outside of the enum range too, that is something for a warning, but not a runtime error.