On Tuesday, 21 November 2017 at 18:49:40 UTC, David  Zhang wrote:
        assert(false, chars[0..str.length]);
}

What am I missing here?

You're escaping a reference to a local variable there. chars[] is a pointer to the stack, which is promptly smashed when the assert error starts working up the call chain, so by the time it actually prints, you have undefined behavior.

Reply via email to