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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 9 03:48:37 PDT 2012


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


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
          Component|DMD                         |websites
           Severity|major                       |trivial


--- Comment #3 from monarchdodra at gmail.com 2012-10-09 03:24:37 PDT ---
(In reply to comment #2)
> 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.

Thanks for the explanation. I was not present when "this was discussed a lot",
and the documentation didn't really make it clear.

Anyhow, I took the liberty of updating the documentation.

https://github.com/D-Programming-Language/d-programming-language.org/pulls

Changing to trivial/website/assigned.

-- 
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