[Issue 4895] New: isOutputRange is true for ranges which can't be output ranges
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 19 03:40:26 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4895
Summary: isOutputRange is true for ranges which can't be output
ranges
Product: D
Version: unspecified
Platform: Other
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: jmdavisProg at gmx.com
--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2010-09-19 03:39:49 PDT ---
This compiles:
import std.range;
struct Range
{
@property bool empty()
{
return true;
}
@property int front()
{
return 7;
}
void popFront()
{
}
@property Range save()
{
return this;
}
}
void main()
{
static assert(isInputRange!(Range));
static assert(isOutputRange!(Range, int));
}
It shouldn't. You can't ever assign to front. I believe that the problem is
that this portion of put() ends up being compiled in:
static if (is(typeof(r.front = e, r.popFront())))
{
r.front = e;
r.popFront();
}
since putting static assert(0); in that portion of put() causing the
compilation to fail.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list