[Issue 20534] New: std.format: %r on boolean gives wrong result
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jan 26 12:02:17 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20534
Issue ID: 20534
Summary: std.format: %r on boolean gives wrong result
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: bugzilla at d-ecke.de
The output of %r on booleans gives 4 bytes, not only one, because the bool is
cast to an int before it is formatted. This is inconsistent with other uses of
%r (which is yet undocumented).
void main()
{
import std.format : format;
assert(format("%r",false) == "\0"); // fails
}
--
More information about the Digitalmars-d-bugs
mailing list