digitalmars.D.bugs - [Issue 14653] New: scoped range in foreach
- via Digitalmars-d-bugs (30/31) Jun 05 2015 https://issues.dlang.org/show_bug.cgi?id=14653
https://issues.dlang.org/show_bug.cgi?id=14653 Issue ID: 14653 Summary: scoped range in foreach Product: D Version: D2 Hardware: x86_64 OS: Mac OS X Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: lio+bugzilla lunesu.comFrom http://beta.forum.dlang.org/post/srjjrjrpjgdnlhsqlyca forum.dlang.orgclass SomeRangeType { int a; this(T)(T...) { } ~this() { a = -1; } property int front() { assert(a>=0); return a; } void popFront() { ++a; } property bool empty() { return a < 10; } } void main(string[] args) { import std.typecons; foreach(e; scoped!SomeRangeType(args)) {} } $ dmd -g -debug -run ~/testforeach.d --- killed by signal 11 --
Jun 05 2015