[Issue 8786] assert does not call "invariant()" function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 9 02:10:37 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8786


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #2 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-10-09 01:52:20 PDT ---
Yes, _class_ object's have their invariant called. You're using a struct. It's
cast to bool (like it would be in the condition of an if statement), and your
struct doesn't define a cast to bool, so it doesn't work.

If you want to check the invariant, then take its address so that you're
operating on a pointer to a struct. In that case, it will act the same way that
a class does.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list