This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/30274] [4.2/4.3 Regression] bool bit-field: wrong increment and decremenet



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]