[Issue 14627] Implicit conversion from uint to dchar allows dchar > dchar.max

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu May 28 13:06:59 PDT 2015


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

--- Comment #1 from Lionello Lunesu <lio+bugzilla at lunesu.com> ---
There are two solutions to this:

1. Make dchar.max == uint.max

2. Make dchar = uint use range checks to determine whether implicit cast is
safe


ad 1. This changes dchar.max, but there doesn't appear to be much code
depending on it. In fact, Phobos has a couple `if (d > 0x10FFFF)` which don't
currently make sense.

ad 2. Generate warning/deprecation when the range falls outside 0..0x10FFFF.
breaks some code that assembles a dchar from wchar/char, and fixed by adding
casts.

--


More information about the Digitalmars-d-bugs mailing list