Thread overview
[Issue 6837] New: alias this + UFCS = fail
Oct 21, 2011
Kenji Hara
Oct 22, 2011
Kenji Hara
Nov 16, 2011
Walter Bright
October 21, 2011
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: nobody@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@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: -------
October 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6837


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-10-21 19:04:05 PDT ---
https://github.com/D-Programming-Language/dmd/pull/468

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6837


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-11-16 09:35:12 PST ---
https://github.com/D-Programming-Language/dmd/commit/7c193950c9d7fa8798b93961fd00e215998149bc

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