// (C) Copyright John Maddock 2000. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifdef TEST_STD # include #else # include #endif #include "test.hpp" #include "check_integral_constant.hpp" class bug11324_base { public: bug11324_base & operator=(const bug11324_base&){ throw int(); } virtual ~bug11324_base() {} }; class bug11324_derived : public bug11324_base { public: char data; explicit bug11324_derived(char arg) : data(arg) {} }; #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS struct deleted_default_construct { deleted_default_construct() = delete; deleted_default_construct(char val) : member(val) {} char member; }; #endif struct private_default_construct { private: private_default_construct(); public: private_default_construct(char val) : member(val) {} char member; }; #ifndef BOOST_NO_CXX11_NOEXCEPT struct noexcept_default_construct { noexcept_default_construct()noexcept; noexcept_default_construct(char val)noexcept : member(val) {} char member; }; #endif TT_TEST_BEGIN(has_nothrow_constructor) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); #ifdef BOOST_HAS_LONG_LONG BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::ulong_long_type const volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor< ::boost::long_long_type const volatile>::value, true); #endif #ifdef BOOST_HAS_MS_INT64 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8 const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8 volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int8 const volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16 const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16 volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int16 const volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32 const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32 volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int32 const volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64 const>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64 volatile>::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<__int64 const volatile>::value, true); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); #endif BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); // cases we would like to succeed but can't implement in the language: BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); #endif #if !defined(BOOST_GCC) || (BOOST_GCC >= 40800) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, false); #endif #ifndef BOOST_NO_CXX11_NOEXCEPT BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor::value, true); #endif TT_TEST_END