[Issue 4826] "cannot create associative array" and compiler crash

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 5 19:30:13 PDT 2010


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



--- Comment #1 from brian-schott at cox.net 2010-09-05 19:29:53 PDT ---
Here's the code that fails:
The second opIndexAssign is written this way because of bug 2972.

module testcase;

struct SomeStruct
{
    void opIndexAssign(T)(T[string] value, string key)
        if(is(T : string) || is(T : int))
    {
    }

    void opIndexAssign(T)(SomeStruct value, string key) if(is(T : SomeStruct))
    {
    }
}

void main(string[] args)
{
    auto t = SomeStruct();
    t["test"] = ["key": "value", "otherKey": "otherValue"];
    auto k = SomeStruct();
    t["fails"] = k;
    // Error: cannot create associative array T[string]
    // Segmentation fault
}

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