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-02 13:57:59
#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):
Replying to [comment:8 joseph.thomson@â¦]:
> A trivially copyable class must have:
>
> * No non-trivial copy constructors
> * No non-trivial copy assignment operators
> * No non-trivial move constructors
> * No non-trivial move assignment operators
> * A trivial destructor
>
> `__has_trivial_copy` simply reports whether the class has a trivial copy
constructor.
I get that, and I see that for clang there's a workaround so that
boost::has_trivial_copy *also* checks whether it is copy constructible
(boost/type_traits/has_trivial_copy.hpp )
{{{
template <typename T>
struct has_trivial_copy_impl
{
#ifdef BOOST_HAS_TRIVIAL_COPY
# ifdef __clang__ // Why not do this for GCC 4.9 too?
BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T) &&
boost::is_copy_constructible<T>::value);
# else
BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T));
# endif
#else
BOOST_STATIC_CONSTANT(bool, value =
(::boost::type_traits::ice_and<
::boost::is_pod<T>::value,
::boost::type_traits::ice_not< ::boost::is_volatile<T>::value
>::value
>::value));
#endif
}}}
but this is only the case for Clang, not for GCC 4.9 and up; even though
the semantics of the intrinsic for Clang and GCC are the same; so that's
the problem I think needs addressing (and was the original intend of the
ticket).
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11229#comment:9> 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