Bug 14089 – [REG2.064] Assigning to AA has no value when overriding opAssign
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-31T15:43:00Z
Last change time
2015-02-03T21:18:15Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
sinkuupump
Comments
Comment #0 by sinkuupump — 2015-01-31T15:43:11Z
Introduced in: https://github.com/D-Programming-Language/dmd/pull/2539
void test()
{
Test[int] aa;
Test b = aa[1] = Test();
}
struct Test
{
Test opAssign(Test val) // ok if remove this
{
return this;
}
}
$ dmd test.d
test.d(4): Error: expression 1 in aa ? aa[1].opAssign(Test()) : cast(void)(aa[1] = Test()) is void and has no value
Comment #1 by sinkuupump — 2015-02-01T00:51:04Z
The behavior of AA assign before 2.064 was just returning rhs. But I noticed this is confusing as I unintentionally showed in #0(result of opAssign vs rhs). Please close this issue if the new behavior is intended.