[Issue 8931] array/slice assignment causes destruction + postblit instead of opAssign

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 20 08:02:41 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=8931

Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang at jmdavisProg.co
                   |                            |m

--- Comment #5 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to monarchdodra from comment #4)
> I did some extra thinking about this, and this might be invalid. While one
> might "expect" opAssign to be called, doing this would mean it is impossible
> to have a strong exception safe behavior should one of the assignements
> fails.

IIRC, isn't opAssign actually supposed to assign to a copy and then have the
result blitted into the variable that you're actually assigning to in order to
make it exception safe like you're concerned about? The extension of that would
be to do opAssign into a copy of the static array, and then blit it into the
original afterwards. I'm not sure how desirable that is, but it would be an
extension of what happens with opAssign in general (assuming that I'm
remembering that right).

--


More information about the Digitalmars-d-bugs mailing list