[Issue 23488] New: std.format.sformat mishandles char ranges

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 15 20:04:11 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=23488

          Issue ID: 23488
           Summary: std.format.sformat mishandles char ranges
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: ag0aep6g at gmail.com

struct R
{
    string s = "Ü";
    bool empty() { return s.length == 0; }
    char front() { return s[0]; }
    void popFront() { s = s[1 .. $]; }
}

void main()
{
    import std.format: sformat;
    char[2] buf;
    assert(sformat(buf, "%s", R()) == "Ü"); /* fails; should pass */
}

--


More information about the Digitalmars-d-bugs mailing list