[Bug 24] Arithmetic operators are allowed on boolean expressions
Sean Kelly
sean at f4.ca
Thu Mar 9 23:17:00 PST 2006
Walter Bright wrote:
> "Sean Kelly" <sean at f4.ca> wrote in message
> news:dur6p8$2ila$1 at digitaldaemon.com...
>>> bool x5; x5 += true; // fails because x5+true is int, and int cannot
>>> be
>>> implicitly converted to bool unless it is 0 or 1
>> bool defaults to false/0, so x5 + true should equal 1, which should not
>> fail.
>
> That would be true if x5 is a const, but it isn't, so it doesn't get
> constant folded. The same applies to the other examples.
Oh I see. Makes a lot more sense now :-)
Sean
More information about the Digitalmars-d-bugs
mailing list