Boost logo

Boost-Commit :

From: dwalker07_at_[hidden]
Date: 2008-07-23 18:40:21


Author: dlwalker
Date: 2008-07-23 18:40:20 EDT (Wed, 23 Jul 2008)
New Revision: 47742
URL: http://svn.boost.org/trac/boost/changeset/47742

Log:
Resolved namespace conflict from unadorned call, which fixes #2134
Added:
   trunk/libs/integer/test/issue_2134.cpp (contents, props changed)
Text files modified:
   trunk/boost/integer.hpp | 36 ++++++++++++++++++------------------
   trunk/libs/integer/test/Jamfile.v2 | 1 +
   2 files changed, 19 insertions(+), 18 deletions(-)

Modified: trunk/boost/integer.hpp
==============================================================================
--- trunk/boost/integer.hpp (original)
+++ trunk/boost/integer.hpp 2008-07-23 18:40:20 EDT (Wed, 23 Jul 2008)
@@ -182,57 +182,57 @@
   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

Modified: trunk/libs/integer/test/Jamfile.v2
==============================================================================
--- trunk/libs/integer/test/Jamfile.v2 (original)
+++ trunk/libs/integer/test/Jamfile.v2 2008-07-23 18:40:20 EDT (Wed, 23 Jul 2008)
@@ -16,4 +16,5 @@
             /boost/test//boost_test_exec_monitor/<link>static ]
         [ run static_min_max_test.cpp
             /boost/test//boost_test_exec_monitor/<link>static ]
+ [ compile issue_2134.cpp ]
     ;

Added: trunk/libs/integer/test/issue_2134.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/integer/test/issue_2134.cpp 2008-07-23 18:40:20 EDT (Wed, 23 Jul 2008)
@@ -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; }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk