www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8182] New: with a lazy struct parameter, the struct's destructor is called on the generated delegate

reply d-bugmail puremagic.com writes:
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



$ 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: -------
Jun 01 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8182


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

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



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: -------
Jun 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8182




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


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: -------
Jun 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
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: -------
Jun 21 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8182


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

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



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: -------
Oct 26 2012