May 25, 2012 [Issue 8148] New: properties and the ternary operator | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: mrmocool@gmx.de --- Comment #0 from Trass3r <mrmocool@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: ------- |
December 26, 2012 [Issue 8148] properties and the ternary operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=8148 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies@gmail.com Resolution| |FIXED --- Comment #1 from yebblies <yebblies@gmail.com> 2012-12-27 00:21:39 EST --- Because struct literals are no longer lvalues, t.vPosition = Vec(3,3); doesn't work either. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation