This program:

extern "C" void abort();
typedef bool my_bool;
int main()
{ 
  my_bool b = false;
  int i;

  b++;
  b++;
  i = b;
  if (i != 1)
    abort ();
  return 0;
}

calls abort(), because GCC is generating an increment for the '++' operator
rather than setting the value to true, and so 'i' becomes 2 not 1.


-- 
           Summary: ++ operator with bool typedef increments
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: geoffk at gcc dot gnu dot org


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

Reply via email to