[Issue 5657] Temporary object destruction
http://d.puremagic.com/issues/show_bug.cgi?id=5657 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Comment #9 from Walter Bright bugzi...@digitalmars.com 2011-06-04 12:39:25 PDT --- https://github.com/9rnsr/dmd/commit/bf31931a097a30254e2ce14f114ccba97fb3dc9f https://github.com/D-Programming-Language/dmd/commit/7a73683fa1391c88ab659d453b9104e0ce06293d -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5657] Temporary object destruction
http://d.puremagic.com/issues/show_bug.cgi?id=5657 --- Comment #8 from Walter Bright bugzi...@digitalmars.com 2011-04-21 16:01:40 PDT --- https://github.com/D-Programming-Language/dmd/commit/aef37eb0c8986a508ccf185286465b4cbef8a066 This is a rewrite of Kenji's patch, which was in the right direction but needed to handle a few more cases. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5657] Temporary object destruction
http://d.puremagic.com/issues/show_bug.cgi?id=5657 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #7 from Walter Bright bugzi...@digitalmars.com 2011-04-19 19:28:48 PDT --- The patch fails to call the destructor with the following code: import std.c.stdio; struct S { int x = 1; int bar() { return x; } this(int i) { printf(ctor %p(%d)\n, this, i); t ~= a; } this(this) { printf(postblit %p\n, this); t ~= b; } ~this() { printf(dtor %p\n, this); t ~= c; } static string t; } S bar() { return S(1); } void main() { bar().x += 1; } I'll see if I can come up with a solution. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5657] Temporary object destruction
http://d.puremagic.com/issues/show_bug.cgi?id=5657 --- Comment #6 from Kenji Hara k.hara...@gmail.com 2011-04-16 19:31:55 PDT --- Pull request. https://github.com/D-Programming-Language/dmd/pull/26 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5657] Temporary object destruction
http://d.puremagic.com/issues/show_bug.cgi?id=5657 --- Comment #4 from Kenji Hara k.hara...@gmail.com 2011-04-14 01:18:34 PDT --- Created an attachment (id=942) Test code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5657] Temporary object destruction
http://d.puremagic.com/issues/show_bug.cgi?id=5657 --- Comment #5 from Kenji Hara k.hara...@gmail.com 2011-04-14 01:21:22 PDT --- Created an attachment (id=943) Test results by patched dmd. (In reply to comment #3) Code in online paste sites like ideone often gets deleted. So I suggest to avoid their usage in Bugzilla, and to just inline the text or add attaches. Thank you for your advice. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5657] Temporary object destruction
http://d.puremagic.com/issues/show_bug.cgi?id=5657 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||patch CC||k.hara...@gmail.com --- Comment #2 from Kenji Hara k.hara...@gmail.com 2011-04-13 14:52:41 PDT --- I try to fix remains. Test code: http://ideone.com/5pxTX Test result: http://ideone.com/YeE10 Patch: https://github.com/9rnsr/dmd/compare/master...tempDtor_fix -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5657] Temporary object destruction
http://d.puremagic.com/issues/show_bug.cgi?id=5657 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #3 from bearophile_h...@eml.cc 2011-04-13 16:12:05 PDT --- Code in online paste sites like ideone often gets deleted. So I suggest to avoid their usage in Bugzilla, and to just inline the text or add attaches. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5657] Temporary object destruction
http://d.puremagic.com/issues/show_bug.cgi?id=5657 --- Comment #1 from SHOO zan77...@nifty.com 2011-04-01 04:44:14 PDT --- I tested following commit: https://github.com/D-Programming-Language/dmd/commit/e764b3949ae0f95f8fc4d7d2e9114e29fee12493 with following code: http://ideone.com/Yqomf and result is here: http://ideone.com/qfBnx CONCLUTION: Almost! Its behavior is right except a case to ignore without storing away a temporary object produced in a return value to a variable. +--+--+--++-+ | source | distination | postblit | destructor | correctness | +--+--+--++-+ | constructor | parameter|x | o | OK | | constructor | return value |x | x | OK | | constructor | variable |x | o | OK | | constructor | no operate |x | o | OK | | return value | parameter|x | o | OK | | return value | return value |x | x | OK | | return value | variable |x | o | OK | | return value | no operate |x |_x_ | _NG_| | variable | parameter|o | o | OK | | variable | return value |o | o | OK | | variable | variable |o | o | OK | | variable | no operate | (error) | (error) | OK | +--+--+--++-+ (*) x ... not called / o ... called Minimized case is here: - import std.stdio; struct A{ this(int x) {writeln(ctor);} ~this(){writeln(dtor);} } A foo() { return A(1); } void main() { foo(); } - $ dmd -run main ctor - -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---