diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 23a5776bc..b6ce49fe5 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -954,10 +955,14 @@ namespace boost { inline std::size_t double_to_size(double f) { - return f >= static_cast( - (std::numeric_limits::max)()) - ? (std::numeric_limits::max)() - : static_cast(f); +#if BOOST_WORKAROUND(BOOST_CLANG_VERSION, < 30900) + // https://github.com/boostorg/unordered/pull/354 + volatile +#endif + const double double_size_t_max = + static_cast((std::numeric_limits::max)()); + return f >= double_size_t_max? + (std::numeric_limits::max)(): static_cast(f); } ////////////////////////////////////////////////////////////////////////// diff --git a/test/unordered/rehash_tests.cpp b/test/unordered/rehash_tests.cpp index da0b02712..e96db4d68 100644 --- a/test/unordered/rehash_tests.cpp +++ b/test/unordered/rehash_tests.cpp @@ -836,8 +836,8 @@ namespace rehash_tests { (test_multiset_ptr)(int_multimap_ptr) (test_multiset_tracking)(test_multimap_tracking))( (default_generator)(generate_collisions)(limited_range))) - UNORDERED_TEST(test_gh348_1,((0))) - UNORDERED_TEST(test_gh348_2,((0))) + UNORDERED_TEST(test_gh348_1, ((0))) + UNORDERED_TEST(test_gh348_2, ((0))) // clang-format on #endif } // namespace rehash_tests