D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8039 - `scoped` doesn't call any elaborate destructors for struct fields
Summary: `scoped` doesn't call any elaborate destructors for struct fields
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-04 10:20 UTC by Denis Shelomovskii
Modified: 2012-05-09 00:18 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2012-05-04 10:20:21 UTC
`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);
}
---
Comment 1 Denis Shelomovskii 2012-05-04 12:24:11 UTC
https://github.com/D-Programming-Language/phobos/pull/569
Comment 2 github-bugzilla 2012-05-07 09:37:42 UTC
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/273eb2122665312011b8bb9bd21e9c85aba140c5
Fix Issue 8039 - `scoped` doesn't call any elaborate destructors for struct fields

Phobos isn't a place for runtime stuff like `destroy`. And Phobos developers aren't people who should write/check such stuff.

https://github.com/D-Programming-Language/phobos/commit/cc636bea73841cfe0250a143cfba3400991cb2bd
Merge pull request #569 from denis-sh/scoped-bug8039-fix

Fix Issue 8039 - `scoped` doesn't call any elaborate destructors for struct fields