Re: [Boost-bugs] [Boost C++ Libraries] #11786: Shouldn't boost::container::vector handle self-move-assignment?

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11786: Shouldn't boost::container::vector handle self-move-assignment?
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-11-06 20:54:47


#11786: Shouldn't boost::container::vector handle self-move-assignment?
---------------------------------+------------------------
  Reporter: fredrik.astrom89@… | Owner: igaztanaga
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: container
   Version: Boost 1.59.0 | Severity: Problem
Resolution: fixed | Keywords:
---------------------------------+------------------------
Changes (by igaztanaga):

 * status: new => closed
 * resolution: => fixed

Comment:

 Thanks for the report. It's an error in the comment as self assignment is
 not allowed for move assignments:

 http://en.cppreference.com/w/cpp/utility/move

 "Also, the standard library functions called with xvalue arguments may
 assume the argument is the only reference to the object; if it was
 constructed from an lvalue with std::move, no aliasing checks are made. In
 particular, this means that standard library move assignment operators do
 not have to perform self-assignment checks"

 {{{

 std::vector<int> v = {2, 3, 3};
 v = std::move(v); // undefined behavior

 }}}

 Comment changed in commit
 https://github.com/boostorg/container/commit/08e768f1d89289f0783b5bab9ea9f2eb0753ed70

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11786#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC