[Bug c++/17843] New: Warning not given.

dhruvbird at yahoo dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 5 14:50:00 GMT 2004


#include <stdio.h>

int main()
{
  int x = 0;
  scanf("%d", &x);

  bool b = x;

  switch (b)
    {
    case true:
      x = 23;
      break;

    case false:
      x = 45;
      break;

    default:
      x = 69;
    }
  return x;
}



The following code should give a warning to the effect of unreachable code in
the default: block, which it doesn't.

-Dhruv.

-- 
           Summary: Warning not given.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dhruvbird at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu


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



More information about the Gcc-bugs mailing list