[Issue 8148] New: properties and the ternary operator
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 25 04:09:30 PDT 2012
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: nobody at puremagic.com
ReportedBy: mrmocool at gmx.de
--- Comment #0 from Trass3r <mrmocool at 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: -------
More information about the Digitalmars-d-bugs
mailing list