diff --git a/test/api_test_helpers.hpp b/test/api_test_helpers.hpp index b3da35e..d9c272b 100644 --- a/test/api_test_helpers.hpp +++ b/test/api_test_helpers.hpp @@ -441,6 +441,12 @@ void test_additive_operators_with_type_and_test() #pragma warning(pop) #endif +#if defined(BOOST_MSVC) +#pragma warning(push) +// cast truncates constant value +#pragma warning(disable: 4310) +#endif + template< template< typename > class Wrapper, typename T, typename D, typename AddType > void test_additive_operators_with_type(T value, D delta) { @@ -698,6 +704,10 @@ void test_additive_operators_with_type(T value, D delta) test_additive_operators_with_type_and_test< Wrapper, T, D, AddType >(); } +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + template< template< typename > class Wrapper, typename T, typename D > void test_additive_operators(T value, D delta) { @@ -1169,7 +1179,15 @@ void do_test_integral_api(boost::false_type) { test_base_operators< Wrapper, T >(42, 43, 44); test_additive_operators< Wrapper, T, T >(42, 17); +#if defined(BOOST_MSVC) +#pragma warning(push) +// cast truncates constant value +#pragma warning(disable: 4310) +#endif test_bit_operators< Wrapper, T >((T)0x5f5f5f5f5f5f5f5fULL, (T)0xf5f5f5f5f5f5f5f5ULL); +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif /* test for unsigned overflow/underflow */ test_additive_operators< Wrapper, T, T >((T)-1, 1); @@ -1185,7 +1203,7 @@ void do_test_integral_api(boost::true_type) do_test_integral_api< Wrapper, T >(boost::false_type()); test_additive_wrap< Wrapper, T >(0u); - BOOST_CONSTEXPR_OR_CONST T all_ones = ~(T)0u; + BOOST_CONSTEXPR_OR_CONST T all_ones = (T)-1; test_additive_wrap< Wrapper, T >(all_ones); BOOST_CONSTEXPR_OR_CONST T max_signed_twos_compl = all_ones >> 1; test_additive_wrap< Wrapper, T >(all_ones ^ max_signed_twos_compl); diff --git a/test/atomic_ref_api.cpp b/test/atomic_ref_api.cpp index 1ea1810..e973d1f 100644 --- a/test/atomic_ref_api.cpp +++ b/test/atomic_ref_api.cpp @@ -77,10 +77,11 @@ int main(int, char *[]) test_struct_with_padding_api< atomic_ref_wrapper >(); #endif - aligned_object< const int, boost::atomic_ref< const int >::required_alignment > object(10); - boost::atomic_ref< const int > r(object.get()); - BOOST_TEST_EQ(r.load(boost::memory_order_relaxed), 10); - + { + aligned_object< const int, boost::atomic_ref< const int >::required_alignment > object(10); + boost::atomic_ref< const int > r(object.get()); + BOOST_TEST_EQ(r.load(boost::memory_order_relaxed), 10); + } #if !defined(BOOST_NO_CXX17_DEDUCTION_GUIDES) if (boost::atomic_ref< int >::is_always_lock_free) { diff --git a/test/lockfree.cpp b/test/lockfree.cpp index 297d713..0ac1643 100644 --- a/test/lockfree.cpp +++ b/test/lockfree.cpp @@ -17,6 +17,11 @@ #include #include "aligned_object.hpp" +#if defined(BOOST_MSVC) +// conditional expression is constant +#pragma warning(disable: 4127) +#endif + static const char* const lock_free_level[] = { "never",