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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 27 02:59:25 PDT 2010


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2010-10-27 02:58:32 PDT ---
I don't think this is a bug.
I think the real bug is described in this paragraph:

"Because it is quite possible to have struct which violates its invariants
(thanks to the whole init vs default constructor fiasco), it's quite easy to
have a struct which was default-initialized which you're trying to assign to
and which violates the invariant."

Which is closely related to bug 519. It should NOT be possible to have a struct
which violates its invariant.

For all instantiated structs which have an invariant, the compiler should
insert a check that .init satisfies the invariant. This only has to be done
once per struct (it doesn't need to be checked for each instance of the
struct). If the invariant is CTFEable, it could even be checked at compile
time.

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