[Issue 8039] New: `scoped` doesn't call any elaborate destructors for struct fields

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 4 10:19:05 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8039

           Summary: `scoped` doesn't call any elaborate destructors for
                    struct fields
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis <verylonglogin.reg at gmail.com> 2012-05-04 21:20:21 MSD ---
`dels` is always zero here:
---
unittest
{
    static int dels;
    static struct S { ~this(){ ++dels; } }
    static struct S2 { S[3] s; }

    class A { S s; }
    dels = 0; { scoped!A(); }
    assert(dels == 1);

    class B { S[2] s; }
    dels = 0; { scoped!B(); }
    assert(dels == 2);

    class C { S2[2] s; }
    dels = 0; { scoped!C(); }
    assert(dels == 6);

    class D: A { S2[2] s; }
    dels = 0; { scoped!D(); }
    assert(dels == 1+6);
}
---

-- 
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