Acces Violation: assert with null instance

Stewart Gordon smjg_1998 at yahoo.com
Wed Jan 10 14:14:31 PST 2007


Lionello Lunesu wrote:
> I really think this used to work (like in C++) :
> 
> #class Class {}
> #void main(){
> #    Class c;
> #    assert(c);
> #}
> 
> With 1.0, I get an access violation in 
> _D9invariant12_d_invariantFC6ObjectZv, but why?
<snip>

For some strange reason, assert on an object reference checks that the 
invariants are satisfied instead of that the reference isn't null. 
There's nothing to this effect in the spec, so I don't know how it came 
about.  While it may be useful, it certainly shouldn't do it _instead 
of_ checking it isn't null.

Stewart.


More information about the Digitalmars-d-bugs mailing list