https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81508
Bug ID: 81508 Summary: Control reaches end of non-void function - warning not emmited when optimization is turned on Product: gcc Version: 6.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: juraj.orsulic at fer dot hr Target Milestone: --- Created attachment 41804 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41804&action=edit Minimal working example This is on Ubuntu 17.04, gcc 6.3.0. Running (note that glog has to be installed): g++ -c hybrid_grid_points_processor.cc -Werror=return-type gives: hybrid_grid_points_processor.cc: In function ‘FlushResult Flush()’: hybrid_grid_points_processor.cc:26:1: error: control reaches end of non-void function [-Werror=return-type] } When -O1 or -O2 or -O3 is added, compilation is successful. Minimal working example (hybrid_grid_points_processor.cc) has been attached.