January 22, 2018
https://issues.dlang.org/show_bug.cgi?id=18279

          Issue ID: 18279
           Summary: rt.util.utf does not properly reserve buffer in
                    toUTF16/toUTF16z
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: druntime
          Assignee: nobody@puremagic.com
          Reporter: n8sh.secondary@hotmail.com

The offending pattern:
```
    wchar[] r;
    size_t slen = s.length;
    r.length = slen;
    r.length = 0;
    // ... followed by code that appends to r with ~=
```

The apparent intention is to preallocate the buffer but this idiom doesn't work as pointed out by Dmitry Olshansky: "On append the slice is not the tail so it will reallocate." https://github.com/dlang/phobos/pull/6024#discussion_r160918451

--