Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85060 - in trunk: boost/type_traits libs/type_traits/test
From: antoshkka_at_[hidden]
Date: 2013-07-17 10:38:40


Author: apolukhin
Date: 2013-07-17 10:38:39 EDT (Wed, 17 Jul 2013)
New Revision: 85060
URL: http://svn.boost.org/trac/boost/changeset/85060

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

Text files modified:
   trunk/boost/type_traits/is_copy_constructible.hpp | 12 ++++++++----
   trunk/libs/type_traits/test/is_copy_constructible_test.cpp | 2 +-
   2 files changed, 9 insertions(+), 5 deletions(-)

Modified: trunk/boost/type_traits/is_copy_constructible.hpp
==============================================================================
--- trunk/boost/type_traits/is_copy_constructible.hpp Wed Jul 17 10:09:32 2013 (r85059)
+++ trunk/boost/type_traits/is_copy_constructible.hpp 2013-07-17 10:38:39 EDT (Wed, 17 Jul 2013) (r85060)
@@ -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 @@
     // 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 @@
     BOOST_STATIC_CONSTANT(bool, value = (
         boost::detail::is_copy_constructible_impl2<
             boost::is_base_and_derived<boost::noncopyable, T>::value,
- T>::value
+ T
+ >::value
     ));
 };
 

Modified: trunk/libs/type_traits/test/is_copy_constructible_test.cpp
==============================================================================
--- trunk/libs/type_traits/test/is_copy_constructible_test.cpp Wed Jul 17 10:09:32 2013 (r85059)
+++ trunk/libs/type_traits/test/is_copy_constructible_test.cpp 2013-07-17 10:38:39 EDT (Wed, 17 Jul 2013) (r85060)
@@ -259,7 +259,7 @@
 
 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);
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk