digitalmars.D.bugs - [Issue 14544] New: isForwardRange failed to recognise valid forward
- via Digitalmars-d-bugs (41/41) May 04 2015 https://issues.dlang.org/show_bug.cgi?id=14544
https://issues.dlang.org/show_bug.cgi?id=14544 Issue ID: 14544 Summary: isForwardRange failed to recognise valid forward range Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: Phobos Assignee: nobody puremagic.com Reporter: ketmar ketmar.no-ip.org this code fails static assertion: struct Input { auto opSlice (size_t start, size_t end) { static struct InputSlice { property bool empty () { return false; } property char front () { return 0; } void popFront () {} InputSlice save () { return this; } } import std.range.primitives; static assert(isForwardRange!InputSlice); return InputSlice(); } } fixing code like this tames `isForwardRange`: template isForwardRange(R) { enum bool isForwardRange = isInputRange!R && is(typeof( (inout int = 0) { R r1 = R.init; //old: static assert (is(typeof(r1.save) == R)); auto s1 = r1.save; static assert (is(typeof(s1) == R)); })); } i wonder if some other checking primitives has similar bug. --
May 04 2015