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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 27 12:03:15 PDT 2010


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


Peter Alexander <peter.alexander.au at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.alexander.au at gmail.co
                   |                            |m


--- Comment #3 from Peter Alexander <peter.alexander.au at gmail.com> 2010-10-27 12:02:23 PDT ---
(In reply to comment #2)
> Regardless, I don't see why it would matter what the state of the object is
> prior to opAssign() being called. That's like caring whether the invariant is
> true prior to the constructor call.

It matters if the object being assigned to have resources that it needs to free
(with the invariant possibly being that a pointer to the resource is non-null).

I agree 100% with Don here: .init should satisfy the invariant, which makes
this bug into a non-bug (unless you can think of other valid situations where
the invariant is broken prior to an opAssign call?)

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