public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54046] New: wrong control reaches end of non-void function for switch case with throw and default
@ 2012-07-20 11:49 plasmahh at gmx dot net
  2012-07-20 12:10 ` [Bug c++/54046] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: plasmahh at gmx dot net @ 2012-07-20 11:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54046

             Bug #: 54046
           Summary: wrong control reaches end of non-void function for
                    switch case with throw and default
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: plasmahh@gmx.net


Hi, somehow gcc gets confused in its control flow analysis when a default case
in a switch has a throw and break, and a variable with user defined dtor.

struct A
{
        ~A() { }
};

bool check( int x )
{
        A z;
        switch( x )
        {
                case 0:
                        return false;
                default:
                        throw "X";
                        break;
        }
}

When I either remove the break or the variable z, the warning will not issued
anymore.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-02-01 14:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-20 11:49 [Bug c++/54046] New: wrong control reaches end of non-void function for switch case with throw and default plasmahh at gmx dot net
2012-07-20 12:10 ` [Bug c++/54046] " redi at gcc dot gnu.org
2012-07-20 12:15 ` [Bug c++/54046] [4.6/4.7/4.8 Regression] " redi at gcc dot gnu.org
2012-07-20 12:40 ` jakub at gcc dot gnu.org
2012-07-20 12:58 ` jakub at gcc dot gnu.org
2012-07-20 15:15 ` ebotcazou at gcc dot gnu.org
2012-09-07 10:03 ` rguenth at gcc dot gnu.org
2012-11-20 16:03 ` jakub at gcc dot gnu.org
2012-11-20 17:27 ` jakub at gcc dot gnu.org
2012-11-23 16:04 ` jakub at gcc dot gnu.org
2013-02-01 14:03 ` [Bug c++/54046] [4.6/4.7 " jakub at gcc dot gnu.org
2013-02-01 14:26 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).