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-28 21:28:58
#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 joseph.thomson@â¦):
Sorry, I incorrectly assumed that trunk would contain the latest version
of the source code (I was using 1.57.0, tested 1.58.0 briefly, and then
looked to fix the change in trunk).
I have just tested your update, and it seems conceptually fine. However,
it fails to compile on MSVC because `yes_type` and `no_type` are
undefined. Copy-paste error I think. Here is the test program I used:
{{{
#include <boost/container/vector.hpp>
#include <iostream>
#include <memory>
int main() {
auto deleter = [](int*) {
std::cout << "delete\n";
};
using T = std::unique_ptr<int, decltype(deleter)>;
std::cout << std::boolalpha;
std::cout << "is_copy_constructible: " <<
boost::move_detail::is_copy_constructible<T>::value << "\n";
std::cout << "is_copy_assignable: " <<
boost::move_detail::is_copy_assignable<T>::value << "\n";
std::cout << "is_trivially_copy_constructible: " <<
boost::move_detail::is_trivially_copy_constructible<T>::value << "\n";
std::cout << "is_trivially_copy_assignable: " <<
boost::move_detail::is_trivially_copy_assignable<T>::value << "\n";
boost::container::vector<T> values;
values.push_back(T(new int(), deleter));
values.push_back(T(new int(), deleter));
}
}}}
You assessment about the MSVC behaviour agrees with mine. Boost.Container
should still work thanks to the interaction of those two bugs :) I have
looked at the 2015 preview, and it seems that they have fixed
`std::is_copy_constructible` and `std::is_copy_assignable`, but not
`__has_trivial_copy`, `__has_trivial_assign` and
`std::is_trivially_copyable`. I have filed a bug about the latter, but
whether or not it is fixed should not affect Boost.Container, as the
`std::is_copy_constructible` and `std::is_copy_assignable` not correctly
return false in this case.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11229#comment:5> 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