gcc version 4.1.1 20060504 #include <string> bool foo ( int k ) { std::string bar; // unused object. not detected. switch ( k ) { default: return false; break; // unreachable code. not detected. } }
$ i486-gnu-linux-g++ bug1.cpp -c -Wall -Os bug1.cpp: In function 'bool foo(int)': bug1.cpp:11: warning: control reaches end of non-void function -- Summary: bogus/missed diagnostic at -Os. Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net GCC build triplet: i486-linux GCC host triplet: i486-linux GCC target triplet: i486-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27654