Resolved namespace conflict from unadorned call, which fixes #2134

[SVN r47742]
This commit is contained in:
Daryle Walker
2008-07-23 22:40:20 +00:00
parent 203705fea6
commit 2b7ed6ebf7
3 changed files with 52 additions and 18 deletions

View File

@ -182,57 +182,57 @@ namespace detail
struct int_max_rank_helper struct int_max_rank_helper
{ {
#ifdef BOOST_HAS_LONG_LONG #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) ); long_long_type >::const_max) );
#elif defined(BOOST_HAS_MS_INT64) #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) ); __int64 >::const_max) );
#else #else
BOOST_STATIC_CONSTANT( int, extended_ = 1 ); BOOST_STATIC_CONSTANT( int, extended_ = 1 );
#endif #endif
BOOST_STATIC_CONSTANT( int, rank = (MaxValue > 0) * (extended_ + BOOST_STATIC_CONSTANT( int, rank = (MaxValue > 0) * (extended_ +
(MaxValue <= integer_traits< long >::const_max) + (MaxValue <= boost::integer_traits< long >::const_max) +
(MaxValue <= integer_traits< int >::const_max) + (MaxValue <= boost::integer_traits< int >::const_max) +
(MaxValue <= integer_traits< short >::const_max) + (MaxValue <= boost::integer_traits< short >::const_max) +
(MaxValue <= integer_traits< signed char >::const_max)) ); (MaxValue <= boost::integer_traits< signed char >::const_max)) );
}; };
template < intmax_t MinValue > template < intmax_t MinValue >
struct int_min_rank_helper struct int_min_rank_helper
{ {
#ifdef BOOST_HAS_LONG_LONG #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) ); long_long_type >::const_min) );
#elif defined(BOOST_HAS_MS_INT64) #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) ); __int64 >::const_min) );
#else #else
BOOST_STATIC_CONSTANT( int, extended_ = 1 ); BOOST_STATIC_CONSTANT( int, extended_ = 1 );
#endif #endif
BOOST_STATIC_CONSTANT( int, rank = (MinValue < 0) * (extended_ + BOOST_STATIC_CONSTANT( int, rank = (MinValue < 0) * (extended_ +
(MinValue >= integer_traits< long >::const_min) + (MinValue >= boost::integer_traits< long >::const_min) +
(MinValue >= integer_traits< int >::const_min) + (MinValue >= boost::integer_traits< int >::const_min) +
(MinValue >= integer_traits< short >::const_min) + (MinValue >= boost::integer_traits< short >::const_min) +
(MinValue >= integer_traits< signed char >::const_min)) ); (MinValue >= boost::integer_traits< signed char >::const_min)) );
}; };
template < uintmax_t Value > template < uintmax_t Value >
struct uint_max_rank_helper struct uint_max_rank_helper
{ {
#ifdef BOOST_HAS_LONG_LONG #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) ); ulong_long_type >::const_max) );
#elif defined(BOOST_HAS_MS_INT64) #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) ); __int64 >::const_max) );
#else #else
BOOST_STATIC_CONSTANT( int, extended_ = 1 ); BOOST_STATIC_CONSTANT( int, extended_ = 1 );
#endif #endif
BOOST_STATIC_CONSTANT( int, rank = extended_ + BOOST_STATIC_CONSTANT( int, rank = extended_ +
(Value <= integer_traits< unsigned long >::const_max) + (Value <= boost::integer_traits< unsigned long >::const_max) +
(Value <= integer_traits< unsigned int >::const_max) + (Value <= boost::integer_traits< unsigned int >::const_max) +
(Value <= integer_traits< unsigned short >::const_max) + (Value <= boost::integer_traits< unsigned short >::const_max) +
(Value <= integer_traits< unsigned char >::const_max) ); (Value <= boost::integer_traits< unsigned char >::const_max) );
}; };
// convert rank to type, Boost.MPL-style // convert rank to type, Boost.MPL-style

View File

@ -16,4 +16,5 @@ test-suite integer
/boost/test//boost_test_exec_monitor/<link>static ] /boost/test//boost_test_exec_monitor/<link>static ]
[ run static_min_max_test.cpp [ run static_min_max_test.cpp
/boost/test//boost_test_exec_monitor/<link>static ] /boost/test//boost_test_exec_monitor/<link>static ]
[ compile issue_2134.cpp ]
; ;

33
test/issue_2134.cpp Normal file
View File

@ -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 <http://www.boost.org/LICENSE_1_0.txt>.)
// See <http://www.boost.org/libs/integer> for documentation.
// See <http://svn.boost.org/trac/boost/ticket/2134> 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 <boost/detail/numeric_traits.hpp>
#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, <boost/detail/numeric_traits.hpp>
// 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 <boost/integer.hpp>
// Main program, minimal (since this is a compile test)
int main() { return 0; }