From 2b7ed6ebf73bbf92487bda93e69b2c4c917d1be4 Mon Sep 17 00:00:00 2001 From: Daryle Walker Date: Wed, 23 Jul 2008 22:40:20 +0000 Subject: [PATCH] Resolved namespace conflict from unadorned call, which fixes #2134 [SVN r47742] --- include/boost/integer.hpp | 36 ++++++++++++++++++------------------ test/Jamfile.v2 | 1 + test/issue_2134.cpp | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 test/issue_2134.cpp diff --git a/include/boost/integer.hpp b/include/boost/integer.hpp index 1f7a750..7e0b86c 100644 --- a/include/boost/integer.hpp +++ b/include/boost/integer.hpp @@ -182,57 +182,57 @@ namespace detail struct int_max_rank_helper { #ifdef BOOST_HAS_LONG_LONG - BOOST_STATIC_CONSTANT( int, extended_ = (MaxValue <= integer_traits< + BOOST_STATIC_CONSTANT( int, extended_ = (MaxValue <= boost::integer_traits< long_long_type >::const_max) ); #elif defined(BOOST_HAS_MS_INT64) - BOOST_STATIC_CONSTANT( int, extended_ = (MaxValue <= integer_traits< + BOOST_STATIC_CONSTANT( int, extended_ = (MaxValue <= boost::integer_traits< __int64 >::const_max) ); #else BOOST_STATIC_CONSTANT( int, extended_ = 1 ); #endif BOOST_STATIC_CONSTANT( int, rank = (MaxValue > 0) * (extended_ + - (MaxValue <= integer_traits< long >::const_max) + - (MaxValue <= integer_traits< int >::const_max) + - (MaxValue <= integer_traits< short >::const_max) + - (MaxValue <= integer_traits< signed char >::const_max)) ); + (MaxValue <= boost::integer_traits< long >::const_max) + + (MaxValue <= boost::integer_traits< int >::const_max) + + (MaxValue <= boost::integer_traits< short >::const_max) + + (MaxValue <= boost::integer_traits< signed char >::const_max)) ); }; template < intmax_t MinValue > struct int_min_rank_helper { #ifdef BOOST_HAS_LONG_LONG - BOOST_STATIC_CONSTANT( int, extended_ = (MinValue >= integer_traits< + BOOST_STATIC_CONSTANT( int, extended_ = (MinValue >= boost::integer_traits< long_long_type >::const_min) ); #elif defined(BOOST_HAS_MS_INT64) - BOOST_STATIC_CONSTANT( int, extended_ = (MinValue >= integer_traits< + BOOST_STATIC_CONSTANT( int, extended_ = (MinValue >= boost::integer_traits< __int64 >::const_min) ); #else BOOST_STATIC_CONSTANT( int, extended_ = 1 ); #endif BOOST_STATIC_CONSTANT( int, rank = (MinValue < 0) * (extended_ + - (MinValue >= integer_traits< long >::const_min) + - (MinValue >= integer_traits< int >::const_min) + - (MinValue >= integer_traits< short >::const_min) + - (MinValue >= integer_traits< signed char >::const_min)) ); + (MinValue >= boost::integer_traits< long >::const_min) + + (MinValue >= boost::integer_traits< int >::const_min) + + (MinValue >= boost::integer_traits< short >::const_min) + + (MinValue >= boost::integer_traits< signed char >::const_min)) ); }; template < uintmax_t Value > struct uint_max_rank_helper { #ifdef BOOST_HAS_LONG_LONG - BOOST_STATIC_CONSTANT( int, extended_ = (Value <= integer_traits< + BOOST_STATIC_CONSTANT( int, extended_ = (Value <= boost::integer_traits< ulong_long_type >::const_max) ); #elif defined(BOOST_HAS_MS_INT64) - BOOST_STATIC_CONSTANT( int, extended_ = (Value <= integer_traits< unsigned + BOOST_STATIC_CONSTANT( int, extended_ = (Value <= boost::integer_traits< unsigned __int64 >::const_max) ); #else BOOST_STATIC_CONSTANT( int, extended_ = 1 ); #endif BOOST_STATIC_CONSTANT( int, rank = extended_ + - (Value <= integer_traits< unsigned long >::const_max) + - (Value <= integer_traits< unsigned int >::const_max) + - (Value <= integer_traits< unsigned short >::const_max) + - (Value <= integer_traits< unsigned char >::const_max) ); + (Value <= boost::integer_traits< unsigned long >::const_max) + + (Value <= boost::integer_traits< unsigned int >::const_max) + + (Value <= boost::integer_traits< unsigned short >::const_max) + + (Value <= boost::integer_traits< unsigned char >::const_max) ); }; // convert rank to type, Boost.MPL-style diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f85e614..a0b5b19 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -16,4 +16,5 @@ test-suite integer /boost/test//boost_test_exec_monitor/static ] [ run static_min_max_test.cpp /boost/test//boost_test_exec_monitor/static ] + [ compile issue_2134.cpp ] ; diff --git a/test/issue_2134.cpp b/test/issue_2134.cpp new file mode 100644 index 0000000..26f8962 --- /dev/null +++ b/test/issue_2134.cpp @@ -0,0 +1,33 @@ +// boost Issue #2134 test program ------------------------------------------// + +// Copyright Daryle Walker 2008. Distributed under the Boost +// Software License, Version 1.0. (See the accompanying file +// LICENSE_1_0.txt or a copy at .) + +// See for documentation. +// See for the issue involved. + +// Revision History +// 23 Jul 2008 Initial version + +// Control if the inclusion error is triggered +#ifndef CONTROL_INCLUDE_TRAITS +#define CONTROL_INCLUDE_TRAITS 1 +#endif + +#if CONTROL_INCLUDE_TRAITS +// This file defines boost::detail::integer_traits. +#include +#endif + +// This is the file with the issue. It has items within the boost::detail +// namespace that referenced an unadorned "integer_traits". This was meant to +// refer to boost::integer_traits. However, +// defines a boost::detail::integer_traits. If that header is #included before +// this one, then b.d.integer_traits (rightfully) took priority, which lead to a +// syntax error. +#include + + +// Main program, minimal (since this is a compile test) +int main() { return 0; }