Bug 15942 – bogus "cannot implicitly convert expression" error when using vector notation to copy from immutable to mutable

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-04-20T19:27:35Z
Last change time
2024-12-13T18:47:34Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
ag0aep6g
Moved to GitHub: dmd#19117 →

Comments

Comment #0 by ag0aep6g — 2016-04-20T19:27:35Z
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[]; } ----
Comment #1 by robert.schadek — 2024-12-13T18:47:34Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19117 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB