Example: class Bug {}; const Bug bug() {}
compile with "-Wreturn-type -O1": no warning compile with "-Wreturn-type -O2": no warning compile with "-Wreturn-type -O3": warning printed If I read the documentation correctly, -Wreturn type should work with or without optimizing. -- Summary: Missing "warning: control reaches end of non-void function" in -O2 Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: grxnprzn at gmx dot net GCC build triplet: i586-suse-linux GCC host triplet: i586-suse-linux GCC target triplet: i586-suse-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41830