The warning available in previous versions of gcc (at least until gcc 3.3)
'unreachable code at beginning of switch statement' is not reported anymore.
This behavior hides programming errors. When compiling this code sample with
'c++ -Wall test.cpp':

int main()
{
        int a;

        switch(1)
        {
                a = 1;
                break;

                default:
                break;
        }

        return 0;
}

No warning is reported. Older versions of gcc issue a warning here. Using
additional switch-related warnings like -Wswitch does not change anything.


-- 
           Summary: Unreachable code at beginning of switch statement is not
                    reported anymore
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Uwe dot Seimet at seimet dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to