[Issue 14575] New: compile error with std.range.refRange when front/back isn't implicitly convertible from const to mutable
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Mon May 11 10:49:13 PDT 2015
    
    
  
https://issues.dlang.org/show_bug.cgi?id=14575
          Issue ID: 14575
           Summary: compile error with std.range.refRange when front/back
                    isn't implicitly convertible from const to mutable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: ag0aep6g at gmail.com
----
import std.range;
struct R
{
    Object front;
    alias back = front;
    bool empty = false;
    void popFront() {empty = true;}
    alias popBack = popFront;
    @property R save() {return this;}
}
static assert(isBidirectionalRange!R);
void main()
{
    R r;
    auto rr = refRange(&r);
}
----
/home/test/d/dmd2/linux/bin64/../../src/phobos/std/range/package.d(7668):
Error: cannot implicitly convert expression ((*this._range).front) of type
const(Object) to object.Object
/home/test/d/dmd2/linux/bin64/../../src/phobos/std/range/package.d(7790):
Error: cannot implicitly convert expression ((*this._range).front) of type
const(Object) to object.Object
/home/test/d/dmd2/linux/bin64/../../src/phobos/std/range/package.d(8281):
Error: template instance std.range.RefRange!(R) error instantiating
test.d(17):        instantiated from here: refRange!(R)
----
Pull request incoming.
--
    
    
More information about the Digitalmars-d-bugs
mailing list