dstring foo() { return cast(dstring) new dchar[](0); } static assert(foo() == ""d);
I think this may be another manifestation of the same bug: dstring foo() { auto result = new dchar[](1); result[0..1] = "a"d; return cast(dstring)result; } static assert(foo() == "a"d); Result: assert interpret.c(2831) sz == newstr->sz
https://github.com/D-Programming-Language/dmd/commit/4fa620ba567bdf1c9be09d46d089a9fc364cc9d2 https://github.com/D-Programming-Language/dmd/commit/8f24469bd1cc3b6b33fd539ccf9d8dab3135156f