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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 22 10:38:19 PST 2012


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 at puremagic.com
        ReportedBy: full.demon at gmail.com


--- Comment #0 from Taco <full.demon at gmail.com> 2012-01-22 10:38:18 PST ---
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: -------


More information about the Digitalmars-d-bugs mailing list