← Back to index
|
Original Bugzilla link
Bug 6837 – alias this + UFCS = fail
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-10-21T07:30:00Z
Last change time
2011-11-16T09:35:12Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0
by k.hara.pg — 2011-10-21T07:30:55Z
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 }
Comment #1
by k.hara.pg — 2011-10-21T19:04:05Z
https://github.com/D-Programming-Language/dmd/pull/468
Comment #2
by bugzilla — 2011-11-16T09:35:12Z
https://github.com/D-Programming-Language/dmd/commit/7c193950c9d7fa8798b93961fd00e215998149bc