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++/45464] New: Warning missing using -Wall when comparing unsigned int and sum of unsigned chars.


The following code will warn for line 6 but not for line 5, however, I
_think_the type of "a  + a + a" is the same as the type of "a + a". 

int main()
{
  unsigned char a=0;
  unsigned int b =0;
  bool test1 =( b < a  + a);//no warning, why
  bool test2 =( b < a + a + a);//warning
  if (wtf1 && wtf2) return 1;
}


-- 
           Summary: Warning missing using -Wall when comparing unsigned int
                    and sum of unsigned chars.
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: brutus at free dot fr


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


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