www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2777] New: alias this doesn't forward __dollar and slice op.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2777

           Summary: alias this doesn't forward __dollar and slice op.
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: dsimcha yahoo.com


import std.stdio;
struct ArrayWrapper(T) {
    T[] array;
    alias array this;
}

void main() {
    ArrayWrapper!(uint) foo;
    foo.length = 5;  // Works
    foo[0] = 1;      // Works
    writeln(foo[0]);  // Works
    writeln(foo[$ - 1]);  // Error:  undefined identifier __dollar
    writeln(foo[0..2]);  // Error:  ArrayWrapper!(uint) cannot be sliced with
[]
}


-- 
Apr 01 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2777


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2011-08-24
21:53:07 PDT ---
https://github.com/D-Programming-Language/dmd/commit/7c29678ed254fc5e577b7a341a12de5b58efd4f5

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