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: unassig...@gcc.gnu.org
        ReportedBy: plasm...@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.

Reply via email to