[Issue 13112] Ignore constness when copying dynamic array argument to static array parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Aug 4 04:16:13 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=13112
Mathias LANG <pro.mathias.lang at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |pro.mathias.lang at gmail.com
Resolution|--- |INVALID
--- Comment #1 from Mathias LANG <pro.mathias.lang at 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.
--
More information about the Digitalmars-d-bugs
mailing list