[Issue 20412] New: std.range.put misbehaves when OutputRange.put(void[] exists)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 21 14:45:32 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20412
Issue ID: 20412
Summary: std.range.put misbehaves when OutputRange.put(void[]
exists)
Product: D
Version: D2
Hardware: All
URL: http://dlang.org/
OS: All
Status: NEW
Severity: major
Priority: P3
Component: phobos
Assignee: nobody at puremagic.com
Reporter: eyal at weka.io
Here's a reproduction of the bug:
struct OutputRange {
void put(const(void)[] bytes) {
import std.stdio;
writeln(bytes);
}
}
unittest {
import std.range: put;
OutputRange rng;
put(rng, "Hello"); // Writes [72, 101, 108, 108, 111] as expected
import std.algorithm: map;
put(rng, "Hello".map!((dchar a)=>a)); // Writes the bytes internally
representing the MapResult: [5, 0, 0, 0, 0, 0, 0, 0, 82, 175, 72, 34, 59, 86,
0, 0]
}
--
More information about the Digitalmars-d-bugs
mailing list