www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11877] New: static opSlice is not possible

https://d.puremagic.com/issues/show_bug.cgi?id=11877

           Summary: static opSlice is not possible
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: public dicebot.lv



struct X
{
    static int opSlice(size_t a, size_t b)
    {
        return 42;
    }
}

static assert ( X[1..2] == 42 );

// Error: cannot slice type 'X'

-------------------------------------------

There is not reason why slicing should be prohibited in this case. It conforms
usual operator syntax rewrite rules and has no grammar ambiguity with array
types if slicing bounds are used.

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