digitalmars.D.bugs - [Issue 6186] New: Struct destructor is not called on out parameter
- d-bugmail puremagic.com Jun 20 2011
- d-bugmail puremagic.com Jun 26 2011
- d-bugmail puremagic.com Jun 26 2011
- d-bugmail puremagic.com Jul 09 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6186 Summary: Struct destructor is not called on out parameter Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: k.hara.pg gmail.com --- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2011-06-20 18:26:25 PDT --- An object typed T through out parameter is initialized by T.init (like memcpy), but its destructor is not called before initializing. ---- int dtor_cnt; struct S { int n; ~this(){ dtor_cnt++; } } void test1() { void f1(out S s){} S s = S(1); dtor_cnt = 0; f1(s); assert(dtor_cnt == 1); // NG } void test2() { void f2(out S[2] sa){} S[2] sa = [S(1), S(2)]; dtor_cnt = 0; f2(sa); assert(dtor_cnt == 2); // NG } void main() { test1(); test2(); } ---- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 20 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6186 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com --- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2011-06-26 17:28:44 PDT --- I'm unsure what the right fix is for this. Out variables are supposed to be initialized by the function, not assigned. Hence, I think uninitialized variables should be passed to them, and it should be an error to pass a non-default-initialized variable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 26 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6186 --- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2011-06-26 17:29:25 PDT --- See also: https://github.com/D-Programming-Language/dmd/pull/155 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 26 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6186 Benjamin Thaut <code benjamin-thaut.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |code benjamin-thaut.de --- Comment #3 from Benjamin Thaut <code benjamin-thaut.de> 2012-07-09 09:22:23 PDT --- Why is the github merge request closed? This issue is not fixed yet and the current behaviour leads to really strange bugs... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 09 2012









d-bugmail puremagic.com 