https://issues.dlang.org/show_bug.cgi?id=15026
Issue ID: 15026
Summary: cannot array assign to a slice return value
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
cat > bug.d << CODE
int[] bar()
{
return null;
}
void test()
{
bar() = 2;
}
CODE
----
Error: bar() is not an lvalue
----
Even more annoying with opSlice.
cat > bug.d << CODE
struct Foo
{
int[] opSlice()
{
return null;
}
}
void test()
{
Foo foo;
foo[] = 2;
}
CODE
----
Error: foo[] is not an lvalue
----
Seems like the lvalue check should be done after array assignments are lowered.
--