https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89450
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> --- > Please no. -fstrict-enums currently makes the compiler *more* strictly > conforming, by following the rules of the standard. Your suggestion arguably > makes it *less* conforming, by deciding that valid values should emit a > warning. > > What you want is not how enums work in C++. Please don't abuse > -fstrict-enums when what you want is "some other kind of enum, not one that > strictly follows the C++ standard". I don't insist on that, I'm fully aware that it's a hackish approach. My motivation is chromium package which we build with gcc in openSUSE. In order to handle all warning: control reaches end of non-void function [-Wreturn-type] in switch statements, we have a huge patch: https://build.opensuse.org/package/view_file/network:chromium/chromium-beta/chromium-non-void-return.patch?expand=1 Clang is more tolerant to c++ enums: $ cat wreturn.cpp enum A { a, b, c }; int foo(int argc) { switch ((A)argc) case a: case b: case c: return 0; } int main(int argc, char **argv) { return foo(argc); } $ clang++ -Wall wreturn.cpp [no output]