[Issue 21329] New: Error message for attribute mismatch points to wrong destructor
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Oct 19 15:53:41 UTC 2020
    
    
  
https://issues.dlang.org/show_bug.cgi?id=21329
          Issue ID: 21329
           Summary: Error message for attribute mismatch points to wrong
                    destructor
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: snarwin+bugzilla at gmail.com
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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list