August 04, 2020 [Issue 13112] Ignore constness when copying dynamic array argument to static array parameter | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13112 Mathias LANG <pro.mathias.lang@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |pro.mathias.lang@gmail.com Resolution|--- |INVALID --- Comment #1 from Mathias LANG <pro.mathias.lang@gmail.com> --- The problem is not constness, but that dynamic arrays do not convert implicitly to static array (which IMO is not an issue). The difference you're seeing with variables is because initializer are treated differently. I would say that this behavior is more likely to be the issue than not having implicit conversion from static to dynamic array. The following compiles (but obviously triggers a range error): ``` void f(char[1] arr) {} void main() { string s; f(s[0 .. 1]); } ``` So closing as invalid. -- |
Copyright © 1999-2021 by the D Language Foundation