[Issue 19229] New: formattedWrite destructively iterates over forward ranges
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 6 09:16:04 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19229
Issue ID: 19229
Summary: formattedWrite destructively iterates over forward
ranges
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: simen.kjaras at gmail.com
unittest {
import std.conv;
import std.algorithm;
auto a = [sort([1,2,3])];
assert(text(a) == text(a));
}
The above assert triggers. The issue is std.format.formatRange destructively
iterates over a[i], leaving an exhausted range behind.
std.format.formatRange or its callers need to be made aware of isForwardRange.
--
More information about the Digitalmars-d-bugs
mailing list