www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14653] New: scoped range in foreach

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.com

From http://beta.forum.dlang.org/post/srjjrjrpjgdnlhsqlyca forum.dlang.org
class 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