Bug 6913 – assert(obj) should check null before invariants
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-11-08T16:47:00Z
Last change time
2011-11-08T17:37:10Z
Assigned to
nobody
Creator
Jesse.K.Phillips+D
Comments
Comment #0 by Jesse.K.Phillips+D — 2011-11-08T16:47:07Z
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 by yebblies — 2011-11-08T17:37:10Z
This is an ancient bug.
*** This issue has been marked as a duplicate of issue 796 ***