www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7349] New: assert(0) in class destructor - bad (or incorrect) error

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

           Summary: assert(0) in class destructor - bad (or incorrect)
                    error
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: full.demon gmail.com



class C
{
public:
    this()
    {
    }

    ~this()
    {
        assert (0);
    }
}

void main()
{
    C c = new C;
}

Upon destruction, it throws:
core.exception.InvalidMemoryOperationError

Which is very vague / incorrectly describes the problem. The documentation also
does not mention throwing exceptions is forbidden in destructors (or are they
not?).

For debugging purposes I do like to assert some stuff in the destructor
though...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 22 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7349


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com
           Severity|normal                      |minor


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2012