diff --git a/include/boost/pool/pool.hpp b/include/boost/pool/pool.hpp index 12728a7..f6d9e6c 100644 --- a/include/boost/pool/pool.hpp +++ b/include/boost/pool/pool.hpp @@ -360,7 +360,7 @@ class pool: protected simple_segregated_storage < typename UserAllocator::size_t size_type max_chunks() const { //! Calculated maximum number of memory chunks that can be allocated in a single call by this Pool. size_type POD_size = integer::static_lcm<sizeof(size_type), sizeof(void *)>::value + sizeof(size_type); - return (std::numeric_limits<size_type>::max() - POD_size) / alloc_size(); + return ((std::numeric_limits<size_type>::max)() - POD_size) / alloc_size(); } static void * & nextof(void * const ptr) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 3ec77ea..763af95 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -38,6 +38,7 @@ test-suite pool : [ run test_bug_6701.cpp ] [ run test_threading.cpp : : : <threading>multi <library>/boost/thread//boost_thread ] [ compile test_poisoned_macros.cpp ] + [ compile test_issue_49.cpp ] ; if [ os.environ VALGRIND_OPTS ] diff --git a/test/test_issue_49.cpp b/test/test_issue_49.cpp new file mode 100644 index 0000000..0f174b6 --- /dev/null +++ b/test/test_issue_49.cpp @@ -0,0 +1,19 @@ +/* Copyright (C) 2022 Joel Pelaez Jorge +* +* Use, modification and distribution is subject to the +* Boost Software License, Version 1.0. (See accompanying +* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +*/ + +// Test of issue #49 (https://github.com/boostorg/pool/issues/49) + +#if defined (_WIN32) +# include <Windows.h> +#endif +#include <boost/pool/pool.hpp> + +int main() +{ + boost::pool<> p(1024); + return 0; +}