[Issue 6935] New: struct with @disable this cannot make range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 12 01:12:43 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6935

           Summary: struct with @disable this cannot make range
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2011-11-12 01:11:57 PST ---
Following code should compile, but doesn't.

import std.range;
struct R
{
    @disable this();  // requires explicit initializer

    @property bool empty() const{ return false; }
    @property int front(){ return 0; }
    void popFront(){}

    @property R save(){ return this; }

    int back(){ return 0; }
    void popBack(){}

    int opIndex(size_t n){ return 0; }
    @property size_t length() const { return 0; }
}
static assert(isInputRange!R);
static assert(isForwardRange!R);
static assert(isBidirectionalRange!R);
static assert(isRandomAccessRange!R);

-- 
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