https://issues.dlang.org/show_bug.cgi?id=15041

Vladimir Panteleev <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Vladimir Panteleev <[email protected]> ---
>       assert(p[-1 .. 1] == "aa"); // 'Range violation'

What happens here is that -1 gets implicitly casted to size_t, which is
unsigned, so this becomes p[size_t.max .. 1]. Slicing p[a..b] when a>b is
nonsense, hence the RangeError.

The check is removed when -release is present.

I'm not sure this is a bug.

--

Reply via email to