Issue 20412 - std.range.put misbehaves when OutputRange.put(void[] exists)
Summary: std.range.put misbehaves when OutputRange.put(void[] exists)
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL: http://dlang.org/
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-21 14:45 UTC by Eyal
Modified: 2024-12-01 16:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Eyal 2019-11-21 14:45:32 UTC
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]
}
Comment 1 dlangBugzillaToGithub 2024-12-01 16:36:04 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10400

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB