https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103983

            Bug ID: 103983
           Summary: -Wswitch-bool seems to do nothing ?
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

clang has a warning -Wswitch-bool. There are three cases of
it in Fedora rawhide. 

However, gcc doesn't say anything. See this code:

void g( int);

void f( bool b)
{
        switch (b)
        {
        case false:
                g( 1);
                break;
        case true:
                g( 2);
                break;
        }       
}

$ /home/dcb/gcc/results/bin/gcc -c -O2 -Wall -Wextra -Wswitch-bool -pedantic
jan11b.cc
$ clang++ -g -O2 -Wall jan11b.cc
jan11b.cc:9:2: warning: switch condition has boolean value [-Wswitch-bool]
        switch (b)
        ^       ~
1 warning generated.

Reply via email to