D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21329 - Error message for attribute mismatch points to wrong destructor
Summary: Error message for attribute mismatch points to wrong destructor
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-19 15:53 UTC by Paul Backus
Modified: 2020-10-19 17:00 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 Paul Backus 2020-10-19 15:53:41 UTC
Example program:

---
struct Inner
{
    @system ~this() {}
}

struct Outer
{
    Inner inner;
    @safe ~this() {}
}

@safe void main()
{	
    Outer outer;
}
---

Output when compiled with DMD v2.093.1:

---
onlineapp.d(14): Error: @safe function D main cannot call @system destructor onlineapp.Outer.~this
onlineapp.d(9):        onlineapp.Outer.~this is declared here
---

The error message incorrectly states that Outer.~this is @system, even though it is @safe. The actual problem is that Inner.~this is @system.
Comment 1 Paul Backus 2020-10-19 17:00:05 UTC
Turns out this is already fixed in 2.094.0.