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-04-26 17:11:35


#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 igaztanaga):

 The trait ''is_memtransfer_copy_constructible'', at least in boost 1.58,
 which is the version you've reported, does not depend on boost.TypeTraits
 but on Boost.Move, due to the dependency reduction work on that 1.58
 version.

 In Visual 2013, ''std::is_copy_constructible'' wrongly returns true for
 types with deleted copy constructors or assignments, but fortunately the
 intrinsic ''has_trivial_xxx'' returns false. E.g:

 {{{

 #include <boost/static_assert.hpp>
 #include <boost/move/detail/type_traits.hpp>

 struct asdf
 {
    asdf(const asdf&) = delete;
    asdf & operator=(const asdf&) = delete;
 };

 int main()
 {
    BOOST_STATIC_ASSERT(!(__has_trivial_copy(asdf)));
    BOOST_STATIC_ASSERT(!(__has_trivial_assign(asdf)));

 BOOST_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_constructible<asdf>::value));
 BOOST_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_assignable<asdf>::value));
 }

 }}}

 So ''boost::container::vector'' should not try to ''memcpy'' a type with a
 deleted copy/assignment .

 In any case, if a class has a public copy constructor which is trivial,
 and also a move constructor, boost::container is free to select the copy
 constructor as semantically should be consistent with the move construtor.
 Or are there scenarios where this could be a problem?

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