I suspect there are cleverer things that can be done.
Less clever seemed to work for me: void popFront1(ref char[] s) @trusted pure nothrow { immutable c = s[0]; if (c < 0x80 || c >= 0xFE) { s = s.ptr[1 .. s.length]; } else { import core.bitop; size_t i = 7u - bsr(~c); // N.B. changed uint to size_t import std.algorithm; s = s.ptr[min(i, s.length) .. s.length]; } }