From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100113 invoked by alias); 18 Jun 2015 18:29:10 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 100080 invoked by uid 48); 18 Jun 2015 18:29:06 -0000 From: "brutus at free dot fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/66590] New: switch statement: incorrect warning "reaches end of non-void function" Date: Thu, 18 Jun 2015 18:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: brutus at free dot fr X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-06/txt/msg01679.txt.bz2 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