$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r85072 - in trunk: boost libs/conversion/test
From: antoshkka_at_[hidden]
Date: 2013-07-18 04:45:09
Author: apolukhin
Date: 2013-07-18 04:45:09 EDT (Thu, 18 Jul 2013)
New Revision: 85072
URL: http://svn.boost.org/trac/boost/changeset/85072
Log:
Fixed testing of 128bit integer types and added staic assert that cheks for std::numeric_limits specializations, if they are required for conversion (refs #8790)
Text files modified: 
   trunk/boost/lexical_cast.hpp                                    |     9 +++++++++                               
   trunk/libs/conversion/test/lexical_cast_integral_types_test.cpp |    23 +++++++++++++++++++++--                 
   2 files changed, 30 insertions(+), 2 deletions(-)
Modified: trunk/boost/lexical_cast.hpp
==============================================================================
--- trunk/boost/lexical_cast.hpp	Wed Jul 17 18:14:12 2013	(r85071)
+++ trunk/boost/lexical_cast.hpp	2013-07-18 04:45:09 EDT (Thu, 18 Jul 2013)	(r85072)
@@ -879,6 +879,15 @@
         {
 #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
             BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed);
+
+            // GCC when used with flag -std=c++0x may not have std::numeric_limits
+            // specializations for __int128 and unsigned __int128 types.
+            // Try compilation with -std=gnu++0x or -std=gnu++11.
+            //
+            // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40856
+            BOOST_STATIC_ASSERT_MSG(std::numeric_limits<T>::is_specialized,
+                "std::numeric_limits are not specialized for integral type passed to boost::lexical_cast"
+            );
 #endif
             CharT const czero = lcast_char_constants<CharT>::zero;
             --end;
Modified: trunk/libs/conversion/test/lexical_cast_integral_types_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_integral_types_test.cpp	Wed Jul 17 18:14:12 2013	(r85071)
+++ trunk/libs/conversion/test/lexical_cast_integral_types_test.cpp	2013-07-18 04:45:09 EDT (Thu, 18 Jul 2013)	(r85072)
@@ -558,14 +558,33 @@
 
 
 #ifdef BOOST_LCAST_HAS_INT128
+
+template <bool Specialized, class T>
+struct test_if_specialized {
+    static void test() {}
+};
+
+template <class T>
+struct test_if_specialized<true, T> {
+    static void test() {
+        test_conversion_from_to_integral_minimal<T>();
+    }
+};
+
 void test_conversion_from_to_int128()
 {
-    test_conversion_from_to_integral_minimal<boost::int128_type>();
+    test_if_specialized<
+        std::numeric_limits<boost::int128_type>::is_specialized, 
+        boost::int128_type
+    >::test();
 }
 
 void test_conversion_from_to_uint128()
 {
-    test_conversion_from_to_integral_minimal<boost::uint128_type>();
+    test_if_specialized<
+        std::numeric_limits<boost::int128_type>::is_specialized, 
+        boost::uint128_type
+    >::test();
 }
 #endif