[Issue 6913] New: assert(obj) should check null before invariants

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 8 16:47:43 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6913

           Summary: assert(obj) should check null before invariants
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: Jesse.K.Phillips+D at gmail.com


--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D at gmail.com> 2011-11-08 16:47:07 PST ---
When testing if asserting an object exists, it should verify that it is not
null first.

class A {
    int i;
    invariant() {
        assert(i == 0);
    }
}

void main() {
    A a;
    assert(a);
}

-- 
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