digitalmars.D.bugs - [Issue 24646] New: `is` test broken for invalid bools
- d-bugmail puremagic.com (21/21) Jul 03 https://issues.dlang.org/show_bug.cgi?id=24646
https://issues.dlang.org/show_bug.cgi?id=24646 Issue ID: 24646 Summary: `is` test broken for invalid bools Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: qs.il.paperinik gmail.com The `is` binary operator (`lhs is rhs`) for built-in types should always test the whole bit pattern of whatever it compares. For `bool` it tests only the last bit of the `bool` value. This means that an invalid `bool` (e.g. created by accident in ` system` code) is needlessly hard to debug. Bare-metal tools such as `is` should be able to tell an invalid `bool` apart from a valid `bool` by having an invalid bool be `!is true` and `!is false`, and instead have it `is N` with 2 ≤ `N` ≤ `ubyte.max`. --
Jul 03