https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66590
Bug ID: 66590 Summary: switch statement: incorrect warning "reaches end of non-void function" Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: brutus at free dot fr Target Milestone: --- Created attachment 35803 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35803&action=edit code snippet generated erroneous "end of non-void function" warning If the attached code is compiled with -Wall, gcc versions 4.9.2, 5.1 and others incorrectly warn about reaching end of non-void function. this is typically reproduced with: /opt/install/gcc-4.9.2/bin/g++ -Wall -c switch.cpp warning disappears if: -optimisation is at least -O1 -OR declaration of ~A() line 1 is removed -OR declaration of variable "a" line 6 is removed -OR declaration of variable "tmp" line 9 is removed -OR break on line 9 is removed