digitalmars.D.bugs - [Issue 18991] New: Invalid code in std.iteration.each
- d-bugmail puremagic.com (25/25) Jun 15 2018 https://issues.dlang.org/show_bug.cgi?id=18991
https://issues.dlang.org/show_bug.cgi?id=18991 Issue ID: 18991 Summary: Invalid code in std.iteration.each Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: trikkuz gmail.com Related to: https://issues.dlang.org/show_bug.cgi?id=11934 "each" implementation iterate thru ranges using: foreach(ref x; range) { } If range hasn't a ref front() this code should throw a compile error (IMO) but it doesn't. The worst part is that if x is a struct, ctor is called but dtor is never called. In my case if I iterate just a single node of a tree, node dtor is never called, resources are not freed and in turn the whole tree is never freed (huge memory leak). --
Jun 15 2018