[Issue 10356] invalid reference to "this" in struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jun 17 22:04:06 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10356
--- Comment #2 from Szabo Bogdan <szabobogdan at yahoo.com> 2013-06-17 22:04:05 PDT ---
(In reply to comment #1)
> Can't duplicate.
>
> I'm not sure what those asserts are for, but the first one fails for the
> obvious reason that the associative array hasn't been initialised.
>
> Without the asserts the code runs fine.
I'm sorry... maybe the original program was striped too much... here is a
program where i found the bug:
import std.stdio;
struct Test {
string val = "";
string[] key;
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 t;
t.val = "test";
Test[string] data;
Test v;
v.val = "asd";
data["test"] = v;
writeln(v);
writeln(data["test"]);
data["test"].append(t);
writeln(data["test"].key);
writeln("done");
}
Thanks!
--
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