[Issue 15026] cannot array assign to a slice return value
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Sep 12 00:02:49 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15026
anoneuron at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anoneuron at gmail.com
--- Comment #2 from anoneuron at 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;
}
--
More information about the Digitalmars-d-bugs
mailing list