digitalmars.D.bugs - [Issue 15942] New: bogus "cannot implicitly convert expression"
- via Digitalmars-d-bugs (37/37) Apr 20 2016 https://issues.dlang.org/show_bug.cgi?id=15942
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 puremagic.com Reporter: ag0aep6g 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[]; } ---- --
Apr 20 2016