[Issue 15164] New: std.utf.byDchar is doing an extra popFront to its input range
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Oct 5 13:37:50 PDT 2015
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 at puremagic.com
Reporter: bugzilla at 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
--
More information about the Digitalmars-d-bugs
mailing list