digitalmars.D.bugs - [Issue 18003] New: assert performs implicit conversion of mutable
- d-bugmail puremagic.com (31/31) Nov 21 2017 https://issues.dlang.org/show_bug.cgi?id=18003
https://issues.dlang.org/show_bug.cgi?id=18003 Issue ID: 18003 Summary: assert performs implicit conversion of mutable local static char array to string Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: hsteoh quickfur.ath.cx Code: ------ void f() { char[6] err = "Argh!"; assert(0, err[0 .. $]); } void main() { f(); } ------ In the assert output, the message is garbled because it's a slice of the local variable `err`, which has gone out of scope by the time the error message is displayed. Expected behaviour: assert() should not allow mutable char[] as second argument, or the compiler should not allow implicit conversion of a mutable char[] slice to immutable(char)[]. --
Nov 21 2017