www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5384] New: Rows foreach on alias-this matrix

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

           Summary: Rows foreach on alias-this matrix
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This deprecated D2 code works with DMD 2.051:


typedef int[1][1] Mat;
void main() {
    Mat m;
    foreach (row; m) {}
}


But this alternative:


struct Mat {
    int[1][1] a;
    alias a this;
}
void main() {
    Mat m;
    foreach (row; m) {} // line 7
}


DMD 2.051 prints:

test.d(7): Error: cannot infer type for row

This is something that I'd like to see work, so structs+alias this are better
usable as an alternative of typedef.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 28 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5384


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



Works in 2.060head.

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