www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4895] New: isOutputRange is true for ranges which can't be output ranges

reply d-bugmail puremagic.com writes:
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



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: -------
Sep 19 2010
next sibling parent d-bugmail puremagic.com writes:
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: -------
Jan 09 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4895


Andrei Alexandrescu <andrei metalanguage.com> changed:

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



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: -------
Jan 16 2011