Re: [Boost-bugs] [Boost C++ Libraries] #11229: vector incorrectly copies move-only objects using memcpy

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11229: vector incorrectly copies move-only objects using memcpy
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-12-03 14:57:44


#11229: vector incorrectly copies move-only objects using memcpy
-------------------------------+------------------------
  Reporter: joseph.thomson@… | Owner: igaztanaga
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: move
   Version: Boost 1.58.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+------------------------

Comment (by anonymous):

 So, boost container indeed seems fixed, it behaves correct for Boost 1.59
 with any compiler I threw at it (GCC 4.7, 4.9, 5.1 and Clang 3.7); the
 type traits themselves are indeed broken in the way you describe.

 So test program is this:

 {{{
 #include <memory>
 #include <boost/type_traits.hpp>

 static_assert(boost::has_trivial_copy<std::unique_ptr<int>>::value,
 "unique ptr should have a trivial copy constructor");
 }}}

 This fails for GCC 4.7 and Clang 3.7 (due to the workaround in boost) but
 succeeds for GCC 4.9 and GCC 5.1.

 Since {{{has_trivial_copy_constructor}}} is synonymous, you'll find that
 the assert fails for GCC 4.7 and Clang 3.7 again, but is true for GCC 4.9
 and 5.1; indeed showing the converse behaviour.

 When it comes to boost vector, the following dies badly for Boost 1.58 and
 GCC 4.9 / 5.1 but is fine for Boost 1.59 with any compiler (or for boost
 1.58 with GCC 4.7 / Clang):

 {{{
 #include <memory>
 #include <boost/container/vector.hpp>

 int main() {
         auto v = boost::container::vector<std::unique_ptr<int>>{};
         for (auto i = 0u; i < 1000*1000; ++i)
                 v.emplace_back(new int(i));
 }
 }}}

 Thanks for your help, it has been quite useful!

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11229#comment:14>
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