Fix issue 12916 - index based insert

https://issues.dlang.org/show_bug.cgi?id=12916

I have not yet reviewed the code, don't pull. It's a PR so it doesn't fall off the radar.