Bug 21329 – Error message for attribute mismatch points to wrong destructor

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-10-19T15:53:41Z
Last change time
2020-10-19T17:00:05Z
Assigned to
No Owner
Creator
Paul Backus

Comments

Comment #0 by snarwin+bugzilla — 2020-10-19T15:53:41Z
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 by snarwin+bugzilla — 2020-10-19T17:00:05Z
Turns out this is already fixed in 2.094.0.