void foo(bool b) { switch ((unsigned int)b) { case 1: case 2: ; } }
% g++ test.cc test.cc: In function void foo(bool): test.cc:6: error: duplicate case value test.cc:5: error: previously used here The bug only appears with casts to (unsigned int) or wider; casts to (int), (unsigned short), etc., work as expected. Reproduces with GCC versions 4.2.4 and 4.3.2. -- Summary: Incorrectly rejects switch((unsigned int)boolvar) Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: foo at mailinator dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39371