Thread overview
[Issue 4895] New: isOutputRange is true for ranges which can't be output ranges
Sep 19, 2010
Jonathan M Davis
September 19, 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@puremagic.com
        ReportedBy: jmdavisProg@gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg@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: -------
January 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4895


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4895


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-01-16 15:36:55 PST ---
Fixed with 2.051 or earlier.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------