phobos
phobos copied to clipboard
std.format.sformat mishandles wchar ranges
ag0aep6g reported this on 2022-11-15T20:15:15Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=23489
Description
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 */
}