www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14089] New: [REG2.064] Assigning to AA has no value when

https://issues.dlang.org/show_bug.cgi?id=14089

          Issue ID: 14089
           Summary: [REG2.064] Assigning to AA has no value when
                    overriding opAssign
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: sinkuupump gmail.com

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

--
Jan 31 2015