[Bug 24] Arithmetic operators are allowed on boolean expressions

Walter Bright newshound at digitalmars.com
Thu Mar 9 17:33:01 PST 2006


<d-bugmail at puremagic.com> wrote in message 
news:duqi91$1m4d$1 at digitaldaemon.com...
> So I still maintain that this is a mistake.
>
>  bool x = true + true;
>
> Should not compile. The promotion to ints must occur after the initial
> semantics of the expression are validated.

You're right, it shouldn't compile. The message I get is:

test.d(1): cannot implicitly convert expression (1 + 1) of type int to bool 





More information about the Digitalmars-d-bugs mailing list