March 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7738

           Summary: Can't iterate a std.typecons.Typedef!(int[]) with
                    foreach
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2012-03-19 17:33:07 PDT ---
This compiles in DMD 2.059head:

alias int[] MyArray;
void main() {
    MyArray arr;
    foreach (i, item; arr) {}
}



This doesn't compile:

import std.typecons: Typedef;
alias Typedef!(int[]) MyArray;
void main() {
    MyArray arr;
    foreach (i, item; arr) {}
}

DMD 2.059head gives the error:

test.d(5): Error: invalid foreach aggregate arr


This simpler code gives the same error:

import std.typecons: Typedef;
alias Typedef!(int[]) MyArray;
void main() {
    MyArray arr;
    foreach (item; arr) {}
}


My main use cases for typedef are with arrays. So this problem makes std.typecons.Typedef not much useful.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7738


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |WORKSFORME


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-20 14:08:09 PST ---
Works in 2.061

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7738



--- Comment #2 from bearophile_hugs@eml.cc 2013-01-20 15:12:14 PST ---
(In reply to comment #1)
> Works in 2.061

A step forward for D language.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home