D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6913 - assert(obj) should check null before invariants
Summary: assert(obj) should check null before invariants
Status: RESOLVED DUPLICATE of issue 796
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-08 16:47 UTC by Jesse Phillips
Modified: 2011-11-08 17:37 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jesse Phillips 2011-11-08 16:47:07 UTC
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);
}
Comment 1 yebblies 2011-11-08 17:37:10 UTC
This is an ancient bug.

*** This issue has been marked as a duplicate of issue 796 ***