On Wednesday, 23 October 2019 at 11:33:56 UTC, kinke wrote:
For your example, the template is inferred to be @safe, and
`-release` only elides bounds checks in @system functions
(corresponding to `-boundscheck=safeonly`). Use
`-boundscheck=off` to elide it in all functions.
Thanks. But I'm talking about the compiler being able to figure
out that the expression
haystack[0 .. needle.length]
_never_ (regardless of compiler flags) needs any range checking
because it is _only_ run when
haystack.length >= needle.length
. Do you follow?