www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6837] New: alias this + UFCS = fail

reply d-bugmail puremagic.com writes:
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



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: -------
Oct 21 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6837


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

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



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: -------
Oct 21 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Nov 16 2011