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: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@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: -------