Strange seg fault
gedaiu
szabobogdan at yahoo.com
Wed Jun 12 13:12:46 PDT 2013
Hi,
Can anyone help me why this code goes wrong? I get exit code 139
with DMD 2.063
import std.stdio;
struct Test {
string val = "";
string[] key;
/**
* operator "=" overload
*/
Test opAssign(string val){
this.val = val;
string[1] t;
t = val;
key ~= t;
return this;
}
Test opAssign(Test val){
this.val = val.val;
key ~= val.key;
return this;
}
void append(Test t) {
val ~= t.val;
key ~= t.key;
};
}
void main() {
Test val;
val = "test";
Test[string] data;
Test v;
v = "asd";
data["test"] = v;
writeln(v);
writeln(data["test"]);
data["test"].append(val);
writeln(data["test"].key);
writeln("done");
}
Thanks,
Bogdan
More information about the Digitalmars-d-learn
mailing list