This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66590] New: switch statement: incorrect warning "reaches end of non-void function"
- From: "brutus at free dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 18 Jun 2015 18:29:05 +0000
- Subject: [Bug c++/66590] New: switch statement: incorrect warning "reaches end of non-void function"
- Auto-submitted: auto-generated
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