www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16949] New: [Reg 2.073] confusing safe error message for

https://issues.dlang.org/show_bug.cgi?id=16949

          Issue ID: 16949
           Summary: [Reg 2.073] confusing  safe error message for fields
                    with unsafe destructors
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
struct A
{
    ~this(){}
}

 safe struct B
{
    A a;
}
CODE
dmd -c bug -transition=safe

----
Error: cannot take address of parameter this in  safe function ~this
----

This should have been a deprecation instead of an error hidden by
-transition=safe, hence it's a diagnostic regression. Also missing the line
number btw.

The original useful error message was.
----
bug.d(6): Error:  safe destructor 'bug.B.~this' cannot call  system destructor
'bug.A.~this'
----

--
Dec 04 2016