diff --git a/std/utf.d b/std/utf.d index e6081403fdf..62faf8e013a 100644 --- a/std/utf.d +++ b/std/utf.d @@ -2719,7 +2719,7 @@ auto byCodeUnit(R)(R r) if (isNarrowString!R) void popFront() { r = r[1 .. $]; } auto ref opIndex(size_t index) inout { return r[index]; } - @property auto ref back() const + @property auto ref back() inout { return r[$ - 1]; } @@ -2749,6 +2749,8 @@ auto byCodeUnit(R)(R r) if (isNarrowString!R) R r; } + static assert(isRandomAccessRange!ByCodeUnitImpl); + return ByCodeUnitImpl(r); }