Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84965 - in trunk: boost libs/conversion/test
From: antoshkka_at_[hidden]
Date: 2013-07-07 05:51:59


Author: apolukhin
Date: 2013-07-07 05:51:58 EDT (Sun, 07 Jul 2013)
New Revision: 84965
URL: http://svn.boost.org/trac/boost/changeset/84965

Log:
Fix macro for int128 detection (refs #8790)

Text files modified:
   trunk/boost/lexical_cast.hpp | 4 ++--
   trunk/libs/conversion/test/lexical_cast_integral_types_test.cpp | 6 +++---
   2 files changed, 5 insertions(+), 5 deletions(-)

Modified: trunk/boost/lexical_cast.hpp
==============================================================================
--- trunk/boost/lexical_cast.hpp Sat Jul 6 18:17:40 2013 (r84964)
+++ trunk/boost/lexical_cast.hpp 2013-07-07 05:51:58 EDT (Sun, 07 Jul 2013) (r84965)
@@ -69,11 +69,11 @@
     throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)))
 #endif
 
-#if (defined(BOOST_LCAST_HAS_INT128) && !defined(__GNUC__)) || GCC_VERSION > 40700
+// GCC 4.6 has some issues with int128 and uint128. Issues were fixed in GCC 4.7
+#if defined(BOOST_HAS_INT128) && (!defined(__GNUC__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6))
 #define BOOST_LCAST_HAS_INT128
 #endif
 
-
 namespace boost
 {
     // exception used to indicate runtime lexical_cast failure

Modified: trunk/libs/conversion/test/lexical_cast_integral_types_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_integral_types_test.cpp Sat Jul 6 18:17:40 2013 (r84964)
+++ trunk/libs/conversion/test/lexical_cast_integral_types_test.cpp 2013-07-07 05:51:58 EDT (Sun, 07 Jul 2013) (r84965)
@@ -48,7 +48,7 @@
 #define BOOST_LCAST_NO_WCHAR_T
 #endif
 
-#if (defined(BOOST_LCAST_HAS_INT128) && !defined(__GNUC__)) || GCC_VERSION > 40700
+#if defined(BOOST_HAS_INT128) && (!defined(__GNUC__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6))
 #define BOOST_LCAST_HAS_INT128
 #endif
 
@@ -444,8 +444,8 @@
     // test_conversion_from_to_integral_for_locale
 
     // Overflow test case from David W. Birdsall
- std::string must_owerflow_str = "160000000000000000000";
- std::string must_owerflow_negative_str = "-160000000000000000000";
+ std::string must_owerflow_str = (sizeof(T) < 16 ? "160000000000000000000" : "1600000000000000000000000000000000000000");
+ std::string must_owerflow_negative_str = (sizeof(T) < 16 ? "-160000000000000000000" : "-1600000000000000000000000000000000000000");
     for (int i = 0; i < 15; ++i) {
         BOOST_CHECK_THROW(lexical_cast<T>(must_owerflow_str), bad_lexical_cast);
         BOOST_CHECK_THROW(lexical_cast<T>(must_owerflow_negative_str), bad_lexical_cast);


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