[Issue 23489] New: std.format.sformat mishandles wchar ranges

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


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

          Issue ID: 23489
           Summary: std.format.sformat mishandles wchar 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

Similar to issue 23488, but less urgent for me because I don't use wchars.

struct R
{
    wstring s = "😈";
    bool empty() { return s.length == 0; }
    wchar front() { return s[0]; }
    void popFront() { s = s[1 .. $]; }
}

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

--


More information about the Digitalmars-d-bugs mailing list