https://issues.dlang.org/show_bug.cgi?id=15942
Issue ID: 15942
Summary: bogus "cannot implicitly convert expression" error
when using vector notation to from immutable to
mutable
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
This is rejected, but should be accepted:
----
void main()
{
string s = [1, 2, 3];
auto v = new void[3];
v[] = s[]; /* Error: cannot implicitly convert expression (s[]) of type
string to void[] */
}
----
It's accepted with an intermediate step:
----
void main()
{
string s = [1, 2, 3];
auto v = new void[3];
immutable(void)[] intermediate = s;
v[] = intermediate[];
}
----
--