[Issue 7738] New: Can't iterate a std.typecons.Typedef!(int[]) with foreach
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 19 17:32:50 PDT 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 at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at 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: -------
More information about the Digitalmars-d-bugs
mailing list