$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r80166 - in sandbox/big_number: boost/multiprecision boost/multiprecision/detail libs/multiprecision/test
From: john_at_[hidden]
Date: 2012-08-24 07:08:46
Author: johnmaddock
Date: 2012-08-24 07:08:44 EDT (Fri, 24 Aug 2012)
New Revision: 80166
URL: http://svn.boost.org/trac/boost/changeset/80166
Log:
Fix remaining GCC C++11 failures.
Fix buggy test cases.
Text files modified: 
   sandbox/big_number/boost/multiprecision/cpp_int.hpp             |     2 +-                                      
   sandbox/big_number/boost/multiprecision/detail/number_base.hpp  |    10 ++++++++++                              
   sandbox/big_number/boost/multiprecision/number.hpp              |    11 ++++++++---                             
   sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp |    14 +++++++-------                          
   4 files changed, 26 insertions(+), 11 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/cpp_int.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_int.hpp	(original)
+++ sandbox/big_number/boost/multiprecision/cpp_int.hpp	2012-08-24 07:08:44 EDT (Fri, 24 Aug 2012)
@@ -2811,7 +2811,7 @@
 template <class Integer>
 inline Integer negate_integer(Integer i, const mpl::false_&) BOOST_NOEXCEPT
 {
-   return ~--i;
+   return ~(i-1);
 }
 
 template <class R, unsigned MinBits, bool Signed, class Allocator>
Modified: sandbox/big_number/boost/multiprecision/detail/number_base.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/number_base.hpp	(original)
+++ sandbox/big_number/boost/multiprecision/detail/number_base.hpp	2012-08-24 07:08:44 EDT (Fri, 24 Aug 2012)
@@ -78,6 +78,16 @@
 {
    typedef typename remove_cv<typename decay<const Val>::type>::type type;
 };
+template <class B, class Backend, class Tag>
+struct canonical_imp<number<B, true>, Backend, Tag>
+{
+   typedef B type;
+};
+template <class B, class Backend, class Tag>
+struct canonical_imp<number<B, false>, Backend, Tag>
+{
+   typedef B type;
+};
 template <class Val, class Backend>
 struct canonical_imp<Val, Backend, mpl::int_<0> >
 {
Modified: sandbox/big_number/boost/multiprecision/number.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/number.hpp	(original)
+++ sandbox/big_number/boost/multiprecision/number.hpp	2012-08-24 07:08:44 EDT (Fri, 24 Aug 2012)
@@ -112,7 +112,7 @@
    explicit BOOST_FORCEINLINE number(const number<Other, ET>& val, typename enable_if_c<
          (detail::is_explicitly_convertible<Other, Backend>::value 
             && (detail::is_restricted_conversion<Other, Backend>::value || !boost::is_convertible<Other, Backend>::value))
-         >::type* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<Other>()))
+         >::type* = 0) BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval<Other>())))
       : m_backend(val.backend()) {}
 
    template <class V>
@@ -148,13 +148,13 @@
       do_assign(e, tag_type());
       return *this;
    }
-/*
+
    BOOST_FORCEINLINE number& operator=(const number& e) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = static_cast<const Backend&>(std::declval<Backend>())))
    {
       m_backend = e.m_backend;
       return *this;
    }
-   */
+
    template <class V>
    BOOST_FORCEINLINE typename enable_if<is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type 
       operator=(const V& v) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<typename boost::multiprecision::detail::canonical<V, Backend>::type>()))
@@ -603,6 +603,11 @@
 {
    return this->template convert_to<T>();
 }
+explicit operator bool()const
+{
+   using default_ops::eval_is_zero;
+   return !eval_is_zero(backend());
+}
 #endif
    //
    // Default precision:
Modified: sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp	(original)
+++ sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp	2012-08-24 07:08:44 EDT (Fri, 24 Aug 2012)
@@ -485,16 +485,16 @@
    Real r;
    divide_qr(a, b, c, r);
    BOOST_TEST(c == a / b);
-   BOOST_TEST(r = a % b);
+   BOOST_TEST(r == a % b);
    divide_qr(a + 0, b, c, r);
    BOOST_TEST(c == a / b);
-   BOOST_TEST(r = a % b);
+   BOOST_TEST(r == a % b);
    divide_qr(a, b+0, c, r);
    BOOST_TEST(c == a / b);
-   BOOST_TEST(r = a % b);
+   BOOST_TEST(r == a % b);
    divide_qr(a+0, b+0, c, r);
    BOOST_TEST(c == a / b);
-   BOOST_TEST(r = a % b);
+   BOOST_TEST(r == a % b);
    BOOST_TEST(integer_modulus(a, 57) == a % 57);
    if(std::numeric_limits<Real>::is_signed)
    {
@@ -516,17 +516,17 @@
       BOOST_TEST(lcm(-400, b) == boost::math::lcm(-400, 45));
       divide_qr(a, b, c, r);
       BOOST_TEST(c == a / b);
-      BOOST_TEST(r = a % b);
+      BOOST_TEST(r == a % b);
       BOOST_TEST(integer_modulus(a, 57) == abs(a % 57));
       b = -57;
       divide_qr(a, b, c, r);
       BOOST_TEST(c == a / b);
-      BOOST_TEST(r = a % b);
+      BOOST_TEST(r == a % b);
       BOOST_TEST(integer_modulus(a, -57) == abs(a % -57));
       a = 458;
       divide_qr(a, b, c, r);
       BOOST_TEST(c == a / b);
-      BOOST_TEST(r = a % b);
+      BOOST_TEST(r == a % b);
       BOOST_TEST(integer_modulus(a, -57) == abs(a % -57));
    }
    for(unsigned i = 0; i < 20; ++i)