D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6636 - Destructors of static array elements are not called on function parameter
Summary: Destructors of static array elements are not called on function parameter
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, wrong-code
Depends on:
Blocks:
 
Reported: 2011-09-09 09:10 UTC by Kenji Hara
Modified: 2012-05-07 21:13 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2011-09-09 09:10:48 UTC
static int sdtor;

struct S
{
    ~this()
    {
        ++sdtor;
    }
}

void func(S[3] sa)
{
    // sa should be destructed at the end of func()
}

void main()
{
    sdtor = 0;

    S[3] sa;
    func(sa);
    assert(sdtor == 3);
}
Comment 2 SomeDude 2012-04-27 14:40:55 UTC
This one fails unless compiled with -release option.
Comment 3 github-bugzilla 2012-05-07 19:43:26 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/57d7f41f82bac4efd05053b5ae23642b65ad18aa
Issue 6636 - Destructors of static array elements are not called on function parameter

Call dtor of static array parameter at function scope end.