www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2736] New: ref returns from 'properties' can't be the LHS of augmentation assignment

http://d.puremagic.com/issues/show_bug.cgi?id=2736

           Summary: ref returns from 'properties' can't be the LHS of
                    augmentation assignment
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jarrett.billingsley gmail.com


struct S
{
    int mX;

    ref int x()
    {
        return mX;
    }
}

void main()
{
    S s;
    s.x += 4; // line 20
}


foo.d(20): Error: 's.x' is not a scalar, it is a ref int()
foo.d(20): Error: incompatible types for ((s.x) += (4)): 'ref int()' and 'int'
foo.d(20): Error: 's.x' is not of arithmetic type, it is a ref int()


-- 
Mar 15 2009