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

Reply via email to