Bug 15164 – std.utf.byDchar is doing an extra popFront to its input range

Status
RESOLVED
Resolution
WONTFIX
Severity
blocker
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-10-05T20:37:00Z
Last change time
2015-10-06T00:47:13Z
Assigned to
nobody
Creator
bugzilla

Comments

Comment #0 by bugzilla — 2015-10-05T20:37:50Z
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
Comment #1 by bugzilla — 2015-10-06T00:47:13Z
This won't fix the problem with readf, and I'm not convinced it's actually wrong.