[Issue 12469] New: opIndex does not work on pointers to structs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 25 13:30:50 PDT 2014


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

           Summary: opIndex does not work on pointers to structs
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: brian-schott at cox.net


--- Comment #0 from brian-schott at cox.net 2014-03-25 13:30:48 PDT ---
struct HasOpIndex
{
    int opIndex(string s) { return 1; }
}

int main()
{
    HasOpIndex* hoi = new HasOpIndex;
    return hoi["a"];
}

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

$ rdmd test.d 
test.d(5): Error: cannot implicitly convert expression ("a") of type string to
ulong
Failed: ["dmd", "-v", "-o-", "test.d", "-I."]

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


More information about the Digitalmars-d-bugs mailing list