March 25, 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@puremagic.com
        ReportedBy: brian-schott@cox.net


--- Comment #0 from brian-schott@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: -------
March 25, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12469


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |INVALID


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2014-03-25 21:38:00 CET ---
Indexing into pointers is a C feature that was carried over into D. Hence why
the compiler expects you to pass a size_t index (ulong on x64). Use (*hoi)["a"]
instead.

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