[Issue 15942] New: bogus "cannot implicitly convert expression" error when using vector notation to from immutable to mutable
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Apr 20 12:27:35 PDT 2016
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: nobody at puremagic.com
Reporter: ag0aep6g at gmail.com
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[];
}
----
--
More information about the Digitalmars-d-bugs
mailing list