www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21329] New: Error message for attribute mismatch points to

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 puremagic.com
          Reporter: snarwin+bugzilla 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.

--
Oct 19 2020