http://d.puremagic.com/issues/show_bug.cgi?id=6837
Summary: alias this + UFCS = fail Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: k.hara...@gmail.com --- Comment #0 from Kenji Hara <k.hara...@gmail.com> 2011-10-21 07:30:55 PDT --- struct Ref1(T) { T storage; alias storage this; } struct Ref2(T) { T storage; @property ref T get(){ return storage; } alias get this; } int front(int[] arr){ return arr[0]; } void popFront(ref int[] arr){ arr = arr[1..$]; } void main() { assert([1,2,3].front == 1); auto r1 = Ref1!(int[])([1,2,3]); // assert(r1.front() == 1); // ng assert(r1.front == 1); // ok // r1.popFront(); // ng r1.storage.popFront(); // ok auto r2 = Ref2!(int[])([1,2,3]); // assert(r2.front() == 1); // ng assert(r2.front == 1); // ok // r2.popFront(); // ng // r2.get.popFront(); // ng r2.get().popFront(); // ok } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------