From b75f4873828203704f2878b4173202f4fbe712af Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 2 Dec 2025 12:39:27 +0100 Subject: [PATCH 1/5] Add reproducer test set --- test/Jamfile.v2 | 1 + test/github_issue_150.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/github_issue_150.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index ff83427a9..17157527d 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -88,6 +88,7 @@ run test_comp_xoshiro128f.cpp ; run github_issue_133.cpp ; run github_issue_147.cpp ; +run github_issue_150.cpp ; run niederreiter_base2_validate.cpp /boost/test//boost_unit_test_framework ; run sobol_validate.cpp /boost/test//boost_unit_test_framework ; diff --git a/test/github_issue_150.cpp b/test/github_issue_150.cpp new file mode 100644 index 000000000..d0fe2b716 --- /dev/null +++ b/test/github_issue_150.cpp @@ -0,0 +1,25 @@ +/* +* Copyright Matt Borland 2025. + * Distributed under 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) + * + * See http://www.boost.org for most recent version including documentation. + * + * $Id$ + */ + +#include +#include +#include +#include + +int main() +{ + std::mt19937_64 gen; + boost::random::binomial_distribution dist; + + BOOST_TEST(dist(gen) >= 0); + + return boost::report_errors(); +} From 88d6840a19455fe0e6ecd18fb8be48e4de2cf420 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 2 Dec 2025 12:39:36 +0100 Subject: [PATCH 2/5] Cast arguments prior to taking abs --- include/boost/random/binomial_distribution.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/random/binomial_distribution.hpp b/include/boost/random/binomial_distribution.hpp index 78d1a123a..a98d53b51 100644 --- a/include/boost/random/binomial_distribution.hpp +++ b/include/boost/random/binomial_distribution.hpp @@ -321,7 +321,7 @@ class binomial_distribution { IntType k = static_cast(floor((2*_u.btrd.a/us + _u.btrd.b)*u + _u.btrd.c)); if(k < 0 || k > _t) continue; v = v*_u.btrd.alpha/(_u.btrd.a/(us*us) + _u.btrd.b); - RealType km = abs(k - m); + RealType km = abs(static_cast(k) - static_cast(m)); if(km <= 15) { RealType f = 1; if(m < k) { From df0a6d03edf315ed4c21a308eea831043161dab2 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 22 Jan 2026 19:02:49 +0300 Subject: [PATCH 3/5] Remove dependencies on Boost.StaticAssert. Boost.StaticAssert has been merged into Boost.Config, so remove the dependency. --- CMakeLists.txt | 1 - build.jam | 1 - test/CMakeLists.txt | 1 - 3 files changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6377167b..32b744f45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,6 @@ target_link_libraries(boost_random Boost::dynamic_bitset Boost::integer Boost::io - Boost::static_assert Boost::system Boost::throw_exception Boost::type_traits diff --git a/build.jam b/build.jam index 0d2def629..99a659d08 100644 --- a/build.jam +++ b/build.jam @@ -12,7 +12,6 @@ constant boost_dependencies : /boost/dynamic_bitset//boost_dynamic_bitset /boost/integer//boost_integer /boost/io//boost_io - /boost/static_assert//boost_static_assert /boost/system//boost_system /boost/throw_exception//boost_throw_exception /boost/type_traits//boost_type_traits diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d94cc55d6..443dc320f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -22,7 +22,6 @@ if(HAVE_BOOST_TEST) Boost::multiprecision Boost::numeric_conversion Boost::range - Boost::static_assert Boost::system Boost::throw_exception Boost::type_traits From 17537c7a81847781cdd62e0becd22474468b7717 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 22 Jan 2026 11:19:24 -0500 Subject: [PATCH 4/5] Replace removed GHA macos images --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11b76d9c2..1701c3cfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -248,10 +248,10 @@ jobs: - toolset: clang cxxstd: "11,14,17,20,2b" - os: macos-13 + os: macos-14 - toolset: clang cxxstd: "11,14,17,20,2b" - os: macos-14 + os: macos-15 timeout-minutes: 360 runs-on: ${{matrix.os}} @@ -517,7 +517,6 @@ jobs: matrix: include: - os: ubuntu-24.04 - - os: macos-13 - os: macos-14 - os: macos-15 From dbd4281d89cb6ba663fa83ae0bda6cb46d066fde Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 4 Mar 2026 10:16:04 -0500 Subject: [PATCH 5/5] Cast result to the proper result type --- include/boost/random/uniform_int_distribution.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/random/uniform_int_distribution.hpp b/include/boost/random/uniform_int_distribution.hpp index 8a3ea7b89..a70c4d188 100644 --- a/include/boost/random/uniform_int_distribution.hpp +++ b/include/boost/random/uniform_int_distribution.hpp @@ -120,7 +120,7 @@ T generate_uniform_int( if(mult * range_type(brange) == range - mult + 1) { // The destination range is an integer power of // the generator's range. - return(result); + return static_cast(result); } // Postcondition: mult <= range