Fix tests for is_copy_constructible triat and fix reference-to-reference issue (refs #8802).

[SVN r85060]
This commit is contained in:
Antony Polukhin
2013-07-17 14:38:39 +00:00
parent 449c859c9d
commit adfe8642af
2 changed files with 9 additions and 5 deletions

View File

@ -12,6 +12,7 @@
#include <boost/config.hpp>
#include <boost/type_traits/detail/yes_no_type.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/utility/declval.hpp>
#include <boost/noncopyable.hpp>
@ -65,9 +66,11 @@ struct is_copy_constructible_impl2 {
// T(const T &) = delete;
// ...
// };
BOOST_STATIC_CONSTANT(bool,
value = (sizeof(test(boost::declval<T&>())) == sizeof(boost::type_traits::yes_type))
);
BOOST_STATIC_CONSTANT(bool, value = (
sizeof(test(
boost::declval<BOOST_DEDUCED_TYPENAME boost::add_reference<T>::type>()
)) == sizeof(boost::type_traits::yes_type)
));
};
template <class T>
@ -81,7 +84,8 @@ struct is_copy_constructible_impl {
BOOST_STATIC_CONSTANT(bool, value = (
boost::detail::is_copy_constructible_impl2<
boost::is_base_and_derived<boost::noncopyable, T>::value,
T>::value
T
>::value
));
};

View File

@ -259,7 +259,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<enum_UDT>::value, true
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<int&>::value, true);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<int&&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<const int&>::value, true);