https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94768
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #1) > (In reply to David Binderman from comment #0) > > IMHO, for a C++ function returning non-void, a complete absence of any > > return statement in the function really should produce an error. > > This is a valid C++ program and it would be non-conforming to reject it. The > compiler can't even assume the program has undefined behaviour, because > g(int) could throw an exception, or do something that terminates, or simply > never return (e.g. go into an infinite loops with side effects like I/O). Just to expand on this. undefined at runtime behavior is not supposed to stop compilation of a translation unit.