This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30274] [4.2/4.3 Regression] bool bit-field: wrong increment and decremenet
- From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Feb 2007 20:19:57 -0000
- Subject: [Bug c++/30274] [4.2/4.3 Regression] bool bit-field: wrong increment and decremenet
- References: <bug-30274-10812@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #9 from mmitchel at gcc dot gnu dot org 2007-02-26 20:19 -------
I'm sorry; I did apparently misunderstand. My reading of the report was that x
did not become 2, and that this made the submitter unhappy.
I agree that x should not become 2. Although "2" is a valid *representation*
of "true", converting "x" to "int" must yield "1", not "2". So, either we need
conversion code, or we need to avoid "x" being "2" in the first place. The
latter is clearly more efficient.
Either the C++ front end or the middle end should transform any "++" operation
on "bool" to "= true". I'm not sure if there are languages where the
equivalent of "b = true; ++b" should yield "false". In any case, I suspect
this is most easily done in the front end.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30274