tricky_rvalue_test.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // (C) Copyright John Maddock 2010.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifdef TEST_STD
  6. # include <type_traits>
  7. #else
  8. # include <boost/type_traits/is_convertible.hpp>
  9. # include <boost/type_traits/is_lvalue_reference.hpp>
  10. # include <boost/type_traits/is_rvalue_reference.hpp>
  11. # include <boost/type_traits/is_reference.hpp>
  12. # include <boost/type_traits/is_function.hpp>
  13. #endif
  14. #include "test.hpp"
  15. #include "check_integral_constant.hpp"
  16. #include <boost/detail/workaround.hpp>
  17. TT_TEST_BEGIN(rvalue_reference_test)
  18. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
  19. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_reference<int (&&)(int)>::value, true);
  20. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_rvalue_reference<int (&)(int)>::value, false);
  21. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_rvalue_reference<int (&&)(int)>::value, true);
  22. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_rvalue_reference<int(&&)(int, ...)>::value, true);
  23. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_rvalue_reference<void(&&)(void)>::value, true);
  24. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_rvalue_reference<void(&&)(int, double const&)>::value, true);
  25. #if !(defined(CI_SUPPRESS_KNOWN_ISSUES) && (BOOST_WORKAROUND(BOOST_GCC, < 40700)) || BOOST_WORKAROUND(BOOST_MSVC, <= 1700))
  26. BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int&&, int&>::value), false);
  27. BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int(), int(&&)()>::value), true);
  28. #endif
  29. #endif
  30. TT_TEST_END