digitalmars.D.bugs - [Issue 10356] New: invalid reference to "this" in struct
- d-bugmail puremagic.com (32/32) Jun 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10356
- d-bugmail puremagic.com (14/14) Jun 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10356
- d-bugmail puremagic.com (36/42) Jun 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10356
- d-bugmail puremagic.com (26/26) Jun 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10356
- d-bugmail puremagic.com (11/11) Jun 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10356
- d-bugmail puremagic.com (11/11) Sep 07 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10356
http://d.puremagic.com/issues/show_bug.cgi?id=10356 Summary: invalid reference to "this" in struct Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: druntime AssignedTo: nobody puremagic.com ReportedBy: szabobogdan yahoo.com PDT --- 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 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 14 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10356 John Colvin <john.loughran.colvin gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |john.loughran.colvin gmail. | |com 23:49:40 BST --- 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10356 PDT ---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: -------
Jun 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10356 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: -------
Jun 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10356 John Colvin <john.loughran.colvin gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|druntime |DMD Summary|invalid reference to "this" |AA of structs: opAssign |in struct |error. Severity|normal |major -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10356 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE *** This issue has been marked as a duplicate of issue 6178 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 07 2013