[Issue 10356] invalid reference to "this" in struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 18 07:18:56 PDT 2013


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



--- Comment #3 from John Colvin <john.loughran.colvin at gmail.com> 2013-06-18 15:18:54 BST ---
OK.

A minimized test case:

struct Test 
{
    byte val; //can be anything
    string[] key;

    Test opAssign(Test rhs) //if void, no error.
    {
        //any attempt to read key here causes a segfault or OutOfMemoryError.
        key ~= rhs.key;
        return this;
    }
}

void main()
{
    //only fails using associative array, normal assignment is fine.
    Test[string] data;

    data["test"] = Test();
}


In the meantime, use the signature "void opAssign(Test rhs)" and you'll
(probably) be ok.

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