D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 18872 - -dip1000 does not allow static arrays for types with destructors
Summary: -dip1000 does not allow static arrays for types with destructors
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-18 19:27 UTC by Ate Eskola
Modified: 2020-04-14 15:25 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 Ate Eskola 2018-05-18 19:27:00 UTC
@safe:
static struct AType
{   ~this(){}
}

void main()
{   AType[5] array;
}

complains:
reference to local variable 'array' assigned to non-scope parameter 'a' calling object._ArrayDtor!(CopyPreventer)._ArrayDtor

As I understand it, running a destroyer when finalizing a static array should work just as well as finalizing a single local with an elaborate destructor.
Comment 1 Mathias LANG 2020-04-14 15:25:13 UTC
Fixed by https://github.com/dlang/druntime/pull/3032