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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 1 15:50:19 PDT 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 at puremagic.com
        ReportedBy: mailme+d at nilsb.dyndns.org


--- Comment #0 from Nils <mailme+d at 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: -------


More information about the Digitalmars-d-bugs mailing list