www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7051] New: Class member with un- safe destructor gives confusing error

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7051

           Summary: Class member with un- safe destructor gives confusing
                    error
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code klickverbot.at



---
Consider:
---
struct Foo {
  ~this() {}
}

 safe {
  class Bar {
    Foo f;
  }
}
---

DMD 2.057 Git (887dda0ba) fails with:
---
Error: safe function '~this' cannot call system function '~this'
---

I didn't think about what the best solution for this yet (what exactly is a
»safe class« in the first place?), but the error message should certainly be
improved.

[related to issue 7050]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 02 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7051


timon.gehr gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr gmx.ch



a  safe class is a class that has only safe members.
This design minimizes the annotation overhead for safe code, because you can
mark every function and method in a module as  safe simply by writing

 safe:

at the top.

The error message should certainly be improved though.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 02 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7051




---
 Timon: Yes, that's the intuitive meaning of it, but is this actually
documented somewhere?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 02 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7051




Actually I think it is undocumented, but Andrei might have mentioned it in one
of his articles iirc. SafeD is generally underspecified.

But I think  safe should certainly transitively apply to members.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 02 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7051


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh quickfur.ath.cx



The error message has improved in git HEAD:

/tmp/test.d(6): Error: safe function 'test.Bar.~this' cannot call system
function 'test.Foo.~this'


Should this issue be resolved?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7051


David Nadlinger <code klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2013