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); }
https://github.com/D-Programming-Language/dmd/pull/375
This one fails unless compiled with -release option.
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.