From 83feb20e5151fc4517d28701a7583b52eeb91629 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 23 Jan 2015 19:05:59 +0000 Subject: [PATCH 1/4] Missing #include Test case uses mpl:: types without including the needed header - exposed by ongoing type traits rewrite. --- test/integer_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/integer_test.cpp b/test/integer_test.cpp index fd9e6df..a79db2d 100644 --- a/test/integer_test.cpp +++ b/test/integer_test.cpp @@ -18,6 +18,7 @@ #include // for main, BOOST_TEST #include // for boost::int_t, boost::uint_t #include +#include // for mpl::true_ and false_ #include // for ULONG_MAX, LONG_MAX, LONG_MIN #include // for std::cout (std::endl indirectly) From 7ffb75bb436e1b9307cfe1f0c3b5cb396bdf7f5c Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Sun, 25 Jan 2015 17:03:09 +0100 Subject: [PATCH 2/4] manage with #6694 Boost.Integer part. --- include/boost/integer.hpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/include/boost/integer.hpp b/include/boost/integer.hpp index 48c863c..6a3cc1a 100644 --- a/include/boost/integer.hpp +++ b/include/boost/integer.hpp @@ -42,15 +42,15 @@ namespace boost // fast integers from least integers // int_fast_t<> works correctly for unsigned too, in spite of the name. template< typename LeastInt > - struct int_fast_t - { - typedef LeastInt fast; + struct int_fast_t + { + typedef LeastInt fast; typedef fast type; }; // imps may specialize namespace detail{ - // convert category to type + // convert category to type template< int Category > struct int_least_helper {}; // default is empty template< int Category > struct uint_least_helper {}; // default is empty @@ -138,7 +138,7 @@ namespace boost "No suitable unsigned integer type with the requested number of bits is available."); #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T) // It's really not clear why this workaround should be needed... shrug I guess! JM - BOOST_STATIC_CONSTANT(int, s = + BOOST_STATIC_CONSTANT(int, s = 6 + (Bits <= ::std::numeric_limits::digits) + (Bits <= ::std::numeric_limits::digits) + @@ -147,7 +147,7 @@ namespace boost typedef typename detail::int_least_helper< ::boost::uint_t::s>::least least; #else typedef typename boost::detail::uint_least_helper - < + < #ifdef BOOST_HAS_LONG_LONG (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else @@ -166,16 +166,16 @@ namespace boost // integer templates specifying extreme value ----------------------------// // signed -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) template< boost::long_long_type MaxValue > // maximum value to require support #else template< long MaxValue > // maximum value to require support #endif - struct int_max_value_t + struct int_max_value_t { typedef typename boost::detail::int_least_helper < -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) (MaxValue <= ::boost::integer_traits::const_max) + #else 1 + @@ -188,16 +188,16 @@ namespace boost typedef typename int_fast_t::type fast; }; -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) template< boost::long_long_type MinValue > // minimum value to require support #else template< long MinValue > // minimum value to require support #endif - struct int_min_value_t + struct int_min_value_t { typedef typename boost::detail::int_least_helper < -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) (MinValue >= ::boost::integer_traits::const_min) + #else 1 + @@ -216,12 +216,12 @@ namespace boost #else template< unsigned long MaxValue > // minimum value to require support #endif - struct uint_value_t + struct uint_value_t { #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) // It's really not clear why this workaround should be needed... shrug I guess! JM #if defined(BOOST_NO_INTEGRAL_INT64_T) - BOOST_STATIC_CONSTANT(unsigned, which = + BOOST_STATIC_CONSTANT(unsigned, which = 1 + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + @@ -229,7 +229,7 @@ namespace boost (MaxValue <= ::boost::integer_traits::const_max)); typedef typename detail::int_least_helper< ::boost::uint_value_t::which>::least least; #else // BOOST_NO_INTEGRAL_INT64_T - BOOST_STATIC_CONSTANT(unsigned, which = + BOOST_STATIC_CONSTANT(unsigned, which = 1 + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + @@ -240,7 +240,7 @@ namespace boost #endif // BOOST_NO_INTEGRAL_INT64_T #else typedef typename boost::detail::uint_least_helper - < + < #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) (MaxValue <= ::boost::integer_traits::const_max) + #else From a12b96c011ade69cd38cfa33add39b51e86723d0 Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Sun, 25 Jan 2015 17:11:04 +0100 Subject: [PATCH 3/4] manage with #4881. --- include/boost/integer.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boost/integer.hpp b/include/boost/integer.hpp index 6a3cc1a..9fa0019 100644 --- a/include/boost/integer.hpp +++ b/include/boost/integer.hpp @@ -91,7 +91,8 @@ namespace boost template <> struct exact_signed_base_helper { typedef int exact; }; template <> struct exact_unsigned_base_helper { typedef unsigned int exact; }; #endif -#if ULONG_MAX != UINT_MAX +#if ULONG_MAX != UINT_MAX && ( !defined __TI_COMPILER_VERSION__ || \ + ( __TI_COMPILER_VERSION__ >= 7000000 && !defined __TI_40BIT_LONG__ ) ) template <> struct exact_signed_base_helper { typedef long exact; }; template <> struct exact_unsigned_base_helper { typedef unsigned long exact; }; #endif From 1ff7278d5f4f6aa68386f2b5622b34c44b32e26d Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Sun, 25 Jan 2015 17:26:09 +0100 Subject: [PATCH 4/4] Added compile fail test for uint_t<65>. related to #6169. --- test/Jamfile.v2 | 1 + test/fail_uint_65.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 test/fail_uint_65.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f94bce9..e3b5be1 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -25,5 +25,6 @@ test-suite integer [ compile-fail fail_uint_exact.cpp ] [ compile-fail fail_uint_fast.cpp ] [ compile-fail fail_uint_least.cpp ] + [ compile-fail fail_uint_65.cpp ] [ run common_factor_test.cpp ] ; diff --git a/test/fail_uint_65.cpp b/test/fail_uint_65.cpp new file mode 100644 index 0000000..76b485e --- /dev/null +++ b/test/fail_uint_65.cpp @@ -0,0 +1,13 @@ +// Copyright John Maddock 2012. +// 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) + +#include +#include + +int main() +{ + std::cout << std::numeric_limits::least>::digits; + return 0; +}