Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bogus "cannot implicitly convert expression" error when using vector notation to copy from immutable to mutable #19117

Open
dlangBugzillaToGithub opened this issue Apr 20, 2016 · 0 comments
Labels

Comments

@dlangBugzillaToGithub
Copy link

ag0aep6g reported this on 2016-04-20T19:27:35Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=15942

Description

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[];
}
----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant