Thread overview
[Issue 8182] New: with a lazy struct parameter, the struct's destructor is called on the generated delegate
Jun 01, 2012
Nils
Jun 10, 2012
Nils
Jun 22, 2012
Walter Bright
Oct 26, 2012
Denis Shelomovskij
June 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8182

           Summary: with a lazy struct parameter, the struct's destructor
                    is called on the generated delegate
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: mailme+d@nilsb.dyndns.org


--- Comment #0 from Nils <mailme+d@nilsb.dyndns.org> 2012-06-01 15:52:12 PDT ---
$ cat test.d
import std.stdio;
struct S {
        int x = 42;
        ~this() {
                if(x != 42) writeln((*cast(S delegate()*) &this)().x);
        }
}
void lazily(lazy S) {
}
void main() {
        lazily(S());
}

$ rdmd test.d
42

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8182


Nils <mailme+d@nilsb.dyndns.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Nils <mailme+d@nilsb.dyndns.org> 2012-06-10 16:57:41 PDT ---
https://github.com/D-Programming-Language/dmd/pull/995

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8182



--- Comment #2 from github-bugzilla@puremagic.com 2012-06-21 20:24:10 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7083076a06da8b43c3b515ac7ef0bd8330287f5d add lazy to the "don't destruct" list

Lazy parameters are actually delegates. Calling the struct destructor on them was nonsense.

This fixes issue 8182.

https://github.com/D-Programming-Language/dmd/commit/009ce61ff416f1437e60c37d572c47878d694099 add a test for issue 8182

https://github.com/D-Programming-Language/dmd/commit/d313a470d78efd1995ef27dd37f64a66128bbc4c Merge pull request #995 from NilsBossung/bugzilla8182

fix Issue 8182 - with a lazy struct parameter, the struct's destructor is called on the generated delegate

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8182


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8182


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsancio@gmail.com


--- Comment #3 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-10-26 15:45:48 MSD ---
*** Issue 6167 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------