https://issues.dlang.org/show_bug.cgi?id=13654
--- Comment #1 from [email protected] --- A possible solution is to replace this: auto enumerate(Enumerator = size_t, Range)(Range range, Enumerator start = 0) if (isIntegral!Enumerator && isInputRange!Range) ... if (overflow || result > Enumerator.max) throw new RangeError("overflow in `start + range.length`"); } } ... With this: auto enumerate(Enumerator = size_t, Range)(Range range, Enumerator start = 0) @nogc if (isIntegral!Enumerator && isInputRange!Range) ... if (overflow || result > Enumerator.max) { static immutable err = new RangeError("overflow in `start + range.length`"); throw err; } } } ... But I don't know if immutable errors are really correct. --
