[Bug c++/39371] [4.2/4.3/4.4 Regression] Incorrectly rejects switch((unsigned int)boolvar)
--- Comment #2 from jakub at gcc dot gnu dot org 2009-03-09 08:22 --- This isn't related to just bool, e.g.: void foo (unsigned char b) { switch ((unsigned int) b) { case 1: case 257: break; } } also results in pr39371-2.C:7: warning: large integer implicitly truncated to unsigned type pr39371-2.C:7: error: duplicate case value pr39371-2.C:6: error: previously used here In C both testcases are fine. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39371
[Bug c++/39371] [4.2/4.3/4.4 Regression] Incorrectly rejects switch((unsigned int)boolvar)
--- Comment #3 from jakub at gcc dot gnu dot org 2009-03-09 10:31 --- Patch posted: http://gcc.gnu.org/ml/gcc-patches/2009-03/msg00463.html -- jakub at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org |dot org | URL||http://gcc.gnu.org/ml/gcc- ||patches/2009- ||03/msg00463.html Status|NEW |ASSIGNED Last reconfirmed|2009-03-05 10:35:56 |2009-03-09 10:31:06 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39371
[Bug c++/39371] [4.2/4.3/4.4 Regression] Incorrectly rejects switch((unsigned int)boolvar)
--- Comment #4 from jakub at gcc dot gnu dot org 2009-03-09 19:34 --- Subject: Bug 39371 Author: jakub Date: Mon Mar 9 19:34:10 2009 New Revision: 144732 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=144732 Log: PR c++/39371 * semantics.c (finish_switch_cond): Don't call get_unwidened. * decl.c (finish_case_label): Pass SWITCH_STMT_TYPE as 3rd argument instead of TREE_TYPE (cond). * g++.dg/opt/switch2.C: Add -w to dg-options. * g++.dg/warn/Wswitch-1.C: Adjust expected warnings. * g++.dg/warn/switch1.C: New test. * g++.dg/other/switch3.C: New test. Added: trunk/gcc/testsuite/g++.dg/other/switch3.C trunk/gcc/testsuite/g++.dg/warn/switch1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/opt/switch2.C trunk/gcc/testsuite/g++.dg/warn/Wswitch-1.C -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39371
[Bug c++/39371] [4.2/4.3/4.4 Regression] Incorrectly rejects switch((unsigned int)boolvar)
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Priority|P3 |P2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39371
[Bug c++/39371] [4.2/4.3/4.4 Regression] Incorrectly rejects switch((unsigned int)boolvar)
--- Comment #1 from rguenth at gcc dot gnu dot org 2009-03-05 10:35 --- Confirmed. 2.95.4 only (incorrectly) warned about an out-of-range case value: /space/rguenther/install/gcc-2.95/bin/g++ -S t.C t.C: In function `void foo(bool)': t.C:5: warning: case value out of range -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords||rejects-valid Known to fail||3.3.6 Known to work||2.95.4 Last reconfirmed|-00-00 00:00:00 |2009-03-05 10:35:56 date|| Summary|Incorrectly rejects |[4.2/4.3/4.4 Regression] |switch((unsigned|Incorrectly rejects |int)boolvar)|switch((unsigned ||int)boolvar) Target Milestone|--- |4.2.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39371