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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 27 15:51:35 PDT 2010


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



--- Comment #4 from Jonathan M Davis <jmdavisProg at gmx.com> 2010-10-27 15:50:46 PDT ---
All it takes is assigning to a public member variable or a reference to private
member data, and you can invalidate an invariant. Granted, having an invariant
with a type where you can do that, isn't necessarily the best idea, but it's
quite possible to have a type where you have an invariant and it's invalid
before opAssign() (or any public function) is called, and, unlike most public
functions, there's no need for the invariant to be true before opAssign() is
called.

Of course, what would really help here would be proper default constructors for
structs, but no one has been able to figure that one out yet it seems.

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