https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109554
--- Comment #2 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- And it's clearly documented in https://gcc.gnu.org/gcc-8/changes.html: Flowing off the end of a non-void function is considered unreachable and may be subject to optimization on that basis. As a result of this change, -Wreturn-type warnings are enabled by default for C++. If you insist on ignoring the -Wreturn-type warning, you are doing things wrong.