[Bug c++/30274] [4.2/4.3 Regression] bool bit-field: wrong increment and decremenet
mmitchel at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Feb 26 20:20:00 GMT 2007
------- 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
More information about the Gcc-bugs
mailing list