digitalmars.D.bugs - [Issue 4712] New: Issue of destructor for temporary instance of structs
- d-bugmail puremagic.com (62/62) Aug 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4712
- d-bugmail puremagic.com (12/12) Aug 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4712
- d-bugmail puremagic.com (9/9) Sep 20 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4712
- d-bugmail puremagic.com (12/12) Nov 14 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4712
http://d.puremagic.com/issues/show_bug.cgi?id=4712 Summary: Issue of destructor for temporary instance of structs Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: zan77137 nifty.com This code doesn't work! import std.stdio; auto func(int A = int.init)() { struct XXX { int a; ~this(){ writeln("dtor"); } } return XXX(); } void main() { writeln("start"); { auto x = func!(); } writeln("end"); } result: start dtor end object.Error: Access Violation If I remove the destructor, it runs correctly. Or I set -O switch to compiler, it runs correctly, too. Workaround for this bug is making dummy constructor: import std.stdio; auto func(int A = int.init)() { struct XXX { int a; this(int aa){ a = aa; writeln("ctor"); } ~this(){ writeln("dtor"); } } return XXX(A); } void main() { writeln("start"); { auto x = func!(); } writeln("end"); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4712 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au Is this the same as bug 3516? The fact that turning on the optimiser is not mentioned there, and may indicate it's a different bug. But they seem to be closely related. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4712 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Severity|normal |critical -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 20 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4712 SHOO <zan77137 nifty.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED This issue is already fixed. (Because it was fixed before I knew it, I don't know revision clearly.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 14 2010