https://issues.dlang.org/show_bug.cgi?id=14979
Kenji Hara <k.hara...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code --- Comment #2 from Kenji Hara <k.hara...@gmail.com> --- OK, I confirmed this is actually a dup of issue 14696. To reproduce the issue, we need to specify -unittest. By that, tempCString will make the buffer size smaller and the used heap memory will be destructed at the wrong timing. auto tempCString(To = char, From)(From str) if (isSomeChar!To && (isInputRange!From || isSomeString!From) && isSomeChar!(ElementEncodingType!From)) { ... static struct Res { ... private: To* _ptr; version (unittest) { enum buffLength = 16 / To.sizeof; // smaller size to trigger reallocations } else { enum buffLength = 256 / To.sizeof; // production size } To[256 / To.sizeof] _buff; // the 'small string optimization' --