Skip to content

Commit

Permalink
Work around MSVC warnings in test code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lastique committed Oct 19, 2024
1 parent 68e2df5 commit 405d108
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/api_test_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,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);
Expand All @@ -1185,7 +1193,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);
Expand Down

0 comments on commit 405d108

Please sign in to comment.