digitalmars.D.bugs - [Issue 1815] New: foreach with interval does not increment pointers correctly
- d-bugmail puremagic.com (26/26) Feb 04 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1815
- d-bugmail puremagic.com (9/9) Feb 28 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1815
http://d.puremagic.com/issues/show_bug.cgi?id=1815 Summary: foreach with interval does not increment pointers correctly Product: D Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: andrei metalanguage.com The following code asserts and it shouldn't: void main() { int[] array = new int[5]; uint check = 0; foreach (it; array.ptr .. array.ptr + array.length) { ++check; } assert(check == array.length); } What happens (easily observable by printing it) is that the pointer gets incremented by 1, not by int.sizeof. --
Feb 04 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1815 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed dmd 2.011 --
Feb 28 2008