https://issues.dlang.org/show_bug.cgi?id=9999

Walter Bright <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #17 from Walter Bright <[email protected]> ---
These behaviors in D make sense if one considers a 'bool' to be an integer type
that is one bit in size. There are no special conversion rules in D for bool,
it behaves just like short, int, long, etc.

For example:

In the initialization `integral_type x = ct;`, whenever
`integral_type` is wide enough to fit constant `ct`, the constant can
be used for initialization even though its ostensible type is not the
same as `integral_type`.

This is a nice successful rule in D, without which we'd need to write
nonsense like:

ubyte x = cast(ubyte) 100;

As for overloading, D chooses the tightest conversion when choosing an
overload. This is somewhat surprising, but consistent across bool,
ubyte, and all other integral types. Again, there is no special rule for bool.

Marking as invalid.

--

Reply via email to