https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100700
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org Severity|normal |enhancement --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- [Please include the full command line and the full compiler output in bug reports (as requested in https://gcc.gnu.org/bugs/#need). Links to third party sites are not a substitute (they can go away and the compiler versions they use can change).] $ cat pr100700.c && gcc -S -xc++ pr100700.c int f(unsigned i) { if (i < unsigned(-1)) return i; } enum E { A, B }; int h (enum E e) { switch (e) { case A: return 0; case B: return 0; } } pr100700.c: In function ‘int f(unsigned int)’: pr100700.c:4:1: warning: control reaches end of non-void function [-Wreturn-type] 4 | } | ^ pr100700.c: In function ‘int h(E)’: pr100700.c:13:1: warning: control reaches end of non-void function [-Wreturn-type] 13 | } | ^ In both examples the warning is strictly correct: in a call to f(-1) the function falls off the end, and ditto in a call to h ((enum E)2). I could see value in relaxing the warning for the enum case and issuing it only under some stricter setting (say with -Wextra or under a new level), similarly to -Wswitch-default. I think there already is a request along these lines.