This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/61143] [4.9/4.10 Regression] Arithmetic exception on emplacing into unordered_map moved out


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61143

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to FranÃois Dumont from comment #4)
> I simply considered that the moved container instance wouldn't be reused
> this way, just potentially for some immutable operations. I should have
> checked the Standard regarding the meaning of "valid by unspecified state".

Objects can definitely be re-used after being moved from. This has to work.

> There are indeed numerous places to consider to make this code and any other
> mutable code valid. I would also prefer to avoid those checks but I remember
> that I needed to leave the container in this state for exception guaranty
> reasons in some move operations. I will recall rational of this as soon as I
> can take a look to the code.

We wanted the move constructor to be noexcept. That's important, but so is
being able to reuse the object again.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]