[Issue 6906] New: Cannot assign value into associative array if contains opAssign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 7 12:24:36 PST 2011


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

           Summary: Cannot assign value into associative array if contains
                    opAssign
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: Jesse.K.Phillips+D at gmail.com


--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D at gmail.com> 2011-11-07 12:24:00 PST ---
This code fails to compile because the struct S implement opAssign and the
compiler tries using it rather than the associative arrays insert.

    void main() {
       S[string] ss;
       S s;

       ss["hello"] = s;
    }

    struct S {
       void opAssign(int i) {
       }
    }

test.d(6): Error: function test.S.opAssign (int i) is not callable using
argument types (S)
test.d(6): Error: cannot implicitly convert expression (s) of type S to int
test.d(6): Error: function test.S.opAssign (int i) is not callable using
argument types (S)
test.d(6): Error: cannot implicitly convert expression (s) of type S to int
PS C:\Documents and Settings\jphillips\src\Juno> dmd test.d
test.d(5): Error: function test.S.opAssign (int i) is not callable using
argument types (S)
test.d(5): Error: cannot implicitly convert expression (s) of type S to int
test.d(5): Error: function test.S.opAssign (int i) is not callable using
argument types (S)
test.d(5): Error: cannot implicitly convert expression (s) of type S to int

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