Closed adesitter closed 3 years ago
It turns out that you can make it work with:
This is the same issue as https://svn.boost.org/trac10/ticket/13487
And likely related to more recent changes described in https://github.com/boostorg/move/issues/35 .
Many thanks for the report and the patience. Apart from the boostorg/move#35, small_vector's move constructor incorrectly depended on is_nothrow_move_assignable.
Considering
include <boost/container/small_vector.hpp>
include
struct S_trivial { int i; }; static_assert(std::is_nothrow_move_constructible::value, "");
static_assert(std::is_nothrow_move_assignable::value, "");
struct S1 { int i = 0; }; static_assert(std::is_nothrow_move_constructible::value, "");
static_assert(std::is_nothrow_move_assignable::value, "");
struct S2 { int i = 0; S2(S2&&) noexcept; S2& operator=(S2&&) noexcept; }; static_assert(std::is_nothrow_move_constructible::value, "");
static_assert(std::is_nothrow_move_assignable::value, "");
// Succeed static_assert(std::is_nothrow_move_constructible<boost::container::small_vector<S_trivial, 1>>::value, ""); static_assert(std::is_nothrow_move_assignable<boost::container::small_vector<S_trivial, 1>>::value, "");
// Fail static_assert(std::is_nothrow_move_constructible<boost::container::small_vector<S1, 1>>::value, ""); static_assert(std::is_nothrow_move_assignable<boost::container::small_vector<S1, 1>>::value, "");
// Fail static_assert(std::is_nothrow_move_constructible<boost::container::small_vector<S2, 1>>::value, ""); static_assert(std::is_nothrow_move_assignable<boost::container::small_vector<S2, 1>>::value, "");
and using g++ 9.2 and boost 1.71, one can see that for S1 and S2 the noexcept propertties of the move operations are not propagated.