On 22/11/2007, Tom Browder <[EMAIL PROTECTED]> wrote:
> Compile with g++ 4.3-20071109:
>
>   $ g++-4.3-20071109 -c f.cc -Wconversion
>   f.cc: In function 'void f(unsigned char)':
>   f.cc:3: warning: conversion to 'unsigned char' from 'int' may alter its 
> value
>
> Is this a legitimate warning or a bug?  If so, is there anything to be
> done to eliminate the warning while retaining "-Wconversion"?
>

void f(const unsigned char b)
{
  unsigned char c =  b & (unsigned char) 0xff;
}

[EMAIL PROTECTED]:~/personal/gcc/objdir$ gcc/cc1plus -Wconversion test.C
 void f(unsigned char)
test.C:3: warning: conversion to 'unsigned char' from 'int' may alter its value
test.C:3: warning: conversion to 'unsigned char' from 'int' may alter its value

There is something odd going on, so please open a bug report and add
[EMAIL PROTECTED] to the CC list.

Thanks,

Manuel.

Reply via email to