Thread overview
[Issue 15026] cannot array assign to a slice return value
Sep 08, 2015
Martin Nowak
Dec 17, 2022
Iain Buclaw
September 08, 2015
https://issues.dlang.org/show_bug.cgi?id=15026

--- Comment #1 from Martin Nowak <code@dawg.eu> ---
Workaround is to slice the return value, i.e. `bar()[]` and `foo[][]`.

--
September 12, 2015
https://issues.dlang.org/show_bug.cgi?id=15026

anoneuron@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anoneuron@gmail.com

--- Comment #2 from anoneuron@gmail.com ---
The first example doesn't look to me like it should compile. Is it not equivalent to this?

void test()
{
    (cast(int[]) null) = 2;
}

The second example works if you use opIndexAssign instead of opSlice:

struct Foo
{
    int[] opIndexAssign(int v)
    {
        return null;
    }
}

void test()
{
    Foo foo;
    foo[] = 2;
}

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=15026

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 13
https://issues.dlang.org/show_bug.cgi?id=15026

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19040

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--