[Issue 5058] invariant() should not be called before opAssign()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 31 17:47:11 PST 2011


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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Linux                       |All


--- Comment #10 from Jonathan M Davis <jmdavisProg at gmx.com> 2011-01-31 17:44:55 PST ---
I believe that bug# 5500 is caused by this issue. Appender has uninitialized
data that it assigns to. And since the invariant is called before opAssign is,
the invariant is called on garbage data which may or may not pass the
invariant. Given that opAssign is supposed to completely replace the state of
the object (as it is doing in the case of bug# 5500), I really do think that
the invariant should not be called before opAssign is called. It's easy to have
a struct which actually passes its invariant in its init state which fails the
invariant upon opAssign, because the memory was initialized to void or
otherwise not initialized when allocated. And stuff like appender is going to
do that quite legitimately and safely. So, I think that bug# 5500 is more
evidence that the invariant should _not_ be called before opAssign is called.

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