Strange seg fault

Ali Çehreli acehreli at yahoo.com
Thu Jun 13 09:11:08 PDT 2013


On 06/12/2013 11:56 PM, gedaiu wrote:

 > How should i submit this bug?

You can reduce it to a minimal program first and then submit at

   http://d.puremagic.com/issues/

Here is a reduced program:

struct Test {
     string[] keys;

     Test opAssign(Test rhs){
         assert(this.keys !is null);
         assert(rhs.keys is null);

         keys ~= rhs.keys;

         return this;
     }
}

void main() {
     Test[string] data;
     Test t;

     data["test"] = t;
}

The output:

   core.exception.OutOfMemoryError

The problem seems to be also related to struct initialization: As 
indicated by the asserts in opAssign, although main.t.keys is not null, 
rhs.keys is null.

Ali



More information about the Digitalmars-d-learn mailing list