[Issue 15026] New: cannot array assign to a slice return value
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Sep 7 18:34:41 PDT 2015
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: nobody at puremagic.com
Reporter: code at dawg.eu
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.
--
More information about the Digitalmars-d-bugs
mailing list