This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29295] New: ++ operator with bool typedef increments
- From: "geoffk at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Sep 2006 00:35:26 -0000
- Subject: [Bug c++/29295] New: ++ operator with bool typedef increments
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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