Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.range.put misbehaves when OutputRange.put(void[] exists) #10400

Open
dlangBugzillaToGithub opened this issue Nov 21, 2019 · 0 comments
Open

Comments

@dlangBugzillaToGithub
Copy link

eyal reported this on 2019-11-21T14:45:32Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=20412

Description

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]
}
@LightBender LightBender removed the P2 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants