[Issue 796] Error: AssertError Failure internal\invariant.d(14)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jan 5 06:48:40 PST 2007
http://d.puremagic.com/issues/show_bug.cgi?id=796
fvbommel at wxs.nl changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |spec
------- Comment #1 from fvbommel at wxs.nl 2007-01-05 08:48 -------
It seems to be according to the spec though.
I just looked it up, and assert(object) checks object's invariant; not just
that it isn't null (that's assert(object !is null) apparently).
Not what I would've expected...
This isn't exactly clearly noted: this is mentioned on
http://www.digitalmars.com/d/class.html#invariants but not
http://www.digitalmars.com/d/expression.html#AssertExpression where it would be
expected (especially since you wouldn't normally look at the section on
invariants when figuring out what an assert does).
So maybe this should be noted there too (especially since every other use of
objects in boolean context is a null check AFAIK). I've already added it to the
comments page for that page.
The invariant checking routine in the runtime does perform an assert(o !is
null), but that only gets compiled into a non-release build of Phobos.
In a release build it instead segfaults trying to look up the vtable of the
object. (to get classinfo)
--
More information about the Digitalmars-d-bugs
mailing list