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]

[Bug c++/34198] New: -Wconversion gives apparent erroneous warning with g++ 4.3-20071109


Consider the following code:

f.cc ==>
void f(const unsigned char b)
{
 unsigned char c = static_cast<unsigned char>(b & 0xff);
}
<== f.cc

Compile with g++ 4.1.2:

 $ g++-4.3-20071109 -c f.cc -Wconversion
 $

Note no warnings.

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


-- 
           Summary: -Wconversion gives apparent erroneous warning with g++
                    4.3-20071109
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tom dot browder at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34198


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