https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100700
--- Comment #2 from gnzlbg <gonzalo.gadeschi at gmail dot com> --- > in a call to f(-1) the function falls off the end, Indeed, thanks. Using <= in the condition removes the warning. > and ditto in a call to h ((enum E)2) Until C++17, creating an enum value that's out-of-range of the enum was unspecified behavior. In C++ standard >= 17 (e.g. -std=c++17), this became undefined behavior. So the warning should point at the place where this happens: (enum E)2. The only way in which "h(E e)" can fall of its end in C++>=17 is if the program already had undefined behavior.