c/8715: '~' operator for unsigned char and conversion to bool

jozef.kosoru@pobox.sk jozef.kosoru@pobox.sk
Tue Nov 26 06:56:00 GMT 2002


>Number:         8715
>Category:       c
>Synopsis:       '~' operator for unsigned char and conversion to bool
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 26 05:26:04 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jozef Kosoru
>Release:        gcc-3.2
>Organization:
>Environment:

>Description:
gcc gives the warning when compiling the following code with -Wall:

int main()
{
    unsigned char b = '1';

    bool x = ~b;

    return 0;
}

test.cpp:5: warning: comparison of promoted ~unsigned with constant

g++ has the same behaviour.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list