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

           Summary: properties and the ternary operator
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: mrmoc...@gmx.de


--- Comment #0 from Trass3r <mrmoc...@gmx.de> 2012-05-25 13:11:14 CEST ---
import std.datetime;
import std.stdio;

void main()
{
    Thing t;
    t.vPosition = (Clock.currStdTime % 2 == 0) ? Vec(2, 2) : Vec(3, 3);
    Vec v = t.vPosition;

    writeln("%d %d\n", v.x, v.y);
}

struct Vec
{
    int x;
    int y;
}

struct Thing
{
    @property Vec vPosition() { return mPosition; }
    @property Vec vPosition( const ref Vec value ) { return mPosition = value;
}

private:
    Vec mPosition;
}

$ dmd test.d 
test.d(7): Error: not a property t.vPosition

t.vPosition = Vec(3,3); works.

I think either both has to work or none.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to