www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - assert(object) calls invariant and crash

For some reason this creates an access violation:

	Object o;

Apparently it's by design. This expression is calling o's invariant, it 
does not check for null as I'd expect. But o is null so calling 
invariant just crashes.

According to an old bug report, things have been working like this for 
a long time.

It works according to spec:

I wonder how many time I wrote the above assertion thinking I was just 
checking for null...

Michel Fortin
michel.fortin michelf.com
Feb 16 2010