This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]