digitalmars.D.bugs - [Issue 15164] New: std.utf.byDchar is doing an extra popFront to its
- via Digitalmars-d-bugs (40/40) Oct 05 2015 https://issues.dlang.org/show_bug.cgi?id=15164
https://issues.dlang.org/show_bug.cgi?id=15164 Issue ID: 15164 Summary: std.utf.byDchar is doing an extra popFront to its input range Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: blocker Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.com Consider: import std.utf; import std.stdio; import core.stdc.stdio; struct S { bool empty() { printf("empty\n"); return !s.length; } property auto front() { printf("front\n"); return s[0]; } void popFront() { printf("popFront()\n"); s = s[1 .. $]; } string s; } void main() { auto s = S("1 2 3"); auto r = s.byDchar(); r.empty; r.front; printf("end\n"); } which prints: empty empty front popFront() end The call to popFront should not be happening. This is blocking a fix to regression https://issues.dlang.org/show_bug.cgi?id=14861 --
Oct 05 2015