Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-10-01 05:53:42


Hello,

attached is a patch that fixes a problem with the compile time GCD
algorithm in the pool allocator library when
BOOST_NO_INCLASS_MEMBER_INITIALIZATION is defined.

The problem is, the value of a BOOST_STATIC_CONSTANT() is used as an
argument for a nontype template parameter. The nontype template
parameter is expected to have the type unsigned, which is only true if
BOOST_NO_INCLASS_MEMBER_INITIALIZATION ist NOT defined. Otherwise, the
type is an unnamed enum and the compile (vacpp 5) doesn't find the
correct specialization for the template. A static cast fixes this.

Unfortunately, the test for the pool allocator still doesn't pass.

"/usr/local/src/boost-1.29.0-rc/boost/pool/pool_alloc.hpp", line 129.26:
1540-1108 (S) "void &" is not a valid type.
"/usr/vacpp/include/list", line 48.31: 1540-0700 (I) The previous
message was produced while processing "class
boost::fast_pool_allocator<void,boost::default_user_allocator_new_delete,boost::details::pool::null_mutex,32>".

The source line in <list> that triggers the error reads

typedef typename _A::template rebind<void>::other::pointer _Genptr;

Doesn't the pool allocator need a specialization for void?

Markus


*** ct_gcd_lcm.hpp.~1.5.~ Sat Aug 4 16:31:37 2001
--- ct_gcd_lcm.hpp Tue Oct 1 12:33:10 2002
***************
*** 33,49 ****
  template <unsigned A, unsigned B, bool Bis0>
  struct ct_gcd_helper;
  template <unsigned A, unsigned B>
! struct ct_gcd_helper<A, B, false>
  {
! BOOST_STATIC_CONSTANT(unsigned, A_mod_B_ = A % B);
! BOOST_STATIC_CONSTANT(unsigned, value =
! (::boost::details::pool::details::ct_gcd_helper<B, A_mod_B_,
! ::boost::type_traits::ice_eq<A_mod_B_, 0>::value>::value) );
  };
  template <unsigned A, unsigned B>
! struct ct_gcd_helper<A, B, true>
  {
! BOOST_STATIC_CONSTANT(unsigned, value = A);
  };
  } // namespace details
  
--- 33,51 ----
  template <unsigned A, unsigned B, bool Bis0>
  struct ct_gcd_helper;
  template <unsigned A, unsigned B>
! struct ct_gcd_helper<A, B, true>
  {
! BOOST_STATIC_CONSTANT(unsigned, value = A);
  };
  template <unsigned A, unsigned B>
! struct ct_gcd_helper<A, B, false>
  {
! BOOST_STATIC_CONSTANT(unsigned, A_mod_B_ = A % B);
! BOOST_STATIC_CONSTANT(unsigned, value =
! (::boost::details::pool::details::ct_gcd_helper<
! B, static_cast<unsigned>(A_mod_B_),
! ::boost::type_traits::ice_eq<A_mod_B_, 0>::value
! >::value) );
  };
  } // namespace details
  


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk