Ticket #9440: intrusive_gcc47_drops_qualifiers.patch

File intrusive_gcc47_drops_qualifiers.patch, 5.3 KB (added by Andrey Semashev, 9 years ago)

The patch works around compilation failures with GCC 4.7.2.

  • boost/intrusive/pointer_traits.hpp

    a b  
    257257   {  return dynamic_cast<pointer>(uptr);  }
    258258};
    259259
    260 }  //namespace container {
     260namespace detail {
     261
     262// NOTE: These functions help to alleviate a GCC 4.7.2 bug on Debian Wheezy, when the compiler instantiates
     263//       pointer_traits on an incorrect pointer type. The compiler looses const qualifier from the element type
     264//       of the pointer (i.e. it instantiates pointer_traits<foo*> instead of pointer_traits<const foo*>).
     265template< typename To, typename From >
     266inline To static_cast_ptr(From const& p)
     267{
     268   return pointer_traits< To >::static_cast_from(p);
     269}
     270
     271template< typename To, typename From >
     272inline To const_cast_ptr(From const& p)
     273{
     274   return pointer_traits< To >::const_cast_from(p);
     275}
     276
     277template< typename To, typename From >
     278inline To dynamic_cast_ptr(From const& p)
     279{
     280   return pointer_traits< To >::dynamic_cast_from(p);
     281}
     282
     283template< typename Ptr >
     284inline typename pointer_traits< Ptr >::pointer pointer_to(typename pointer_traits< Ptr >::reference obj)
     285{
     286   return pointer_traits< Ptr >::pointer_to(obj);
     287}
     288
     289}  //namespace detail {
     290}  //namespace intrusive {
    261291}  //namespace boost {
    262292
    263293#include <boost/intrusive/detail/config_end.hpp>
  • boost/intrusive/detail/list_node.hpp

    a b  
    109109   {  members_.nodeptr_ = node;  return static_cast<list_iterator&>(*this);  }
    110110
    111111   const_real_value_traits_ptr get_real_value_traits() const
    112    {  return pointer_traits<const_real_value_traits_ptr>::static_cast_from(members_.get_ptr()); }
     112   {  return boost::intrusive::detail::static_cast_ptr<const_real_value_traits_ptr>(members_.get_ptr()); }
    113113
    114114   public:
    115115   list_iterator& operator++()
  • boost/intrusive/detail/slist_node.hpp

    a b  
    9898   {  members_.nodeptr_ = node;  return static_cast<slist_iterator&>(*this);  }
    9999
    100100   const_real_value_traits_ptr get_real_value_traits() const
    101    {  return pointer_traits<const_real_value_traits_ptr>::static_cast_from(members_.get_ptr()); }
     101   {  return boost::intrusive::detail::static_cast_ptr<const_real_value_traits_ptr>(members_.get_ptr()); }
    102102
    103103   public:
    104104   slist_iterator& operator++()
  • boost/intrusive/detail/tree_node.hpp

    a b  
    165165
    166166   const_real_value_traits_ptr get_real_value_traits() const
    167167   {
    168       return pointer_traits<const_real_value_traits_ptr>::static_cast_from(members_.get_ptr());
     168      return boost::intrusive::detail::static_cast_ptr<const_real_value_traits_ptr>(members_.get_ptr());
    169169   }
    170170
    171171   tree_iterator end_iterator_from_it() const
  • boost/intrusive/list.hpp

    a b  
    180180   typedef typename pointer_traits<node_ptr>::template rebind_pointer<real_value_traits const>::type const_real_value_traits_ptr;
    181181
    182182   const_real_value_traits_ptr real_value_traits_ptr() const
    183    {  return pointer_traits<const_real_value_traits_ptr>::pointer_to(this->get_real_value_traits());  }
     183   {  return boost::intrusive::detail::pointer_to<const_real_value_traits_ptr>(this->get_real_value_traits());  }
    184184
    185185   //! <b>Effects</b>: constructs an empty list.
    186186   //!
  • boost/intrusive/slist.hpp

    a b  
    271271   typedef typename pointer_traits<node_ptr>::template rebind_pointer<const real_value_traits>::type const_real_value_traits_ptr;
    272272
    273273   const_real_value_traits_ptr real_value_traits_ptr() const
    274    {  return pointer_traits<const_real_value_traits_ptr>::pointer_to(this->get_real_value_traits());  }
     274   {  return boost::intrusive::detail::pointer_to<const_real_value_traits_ptr>(this->get_real_value_traits());  }
    275275
    276276   public:
    277277
  • boost/intrusive/bstree.hpp

    a b  
    103103   typedef typename pointer_traits<node_ptr>::template rebind_pointer<const real_value_traits>::type const_real_value_traits_ptr;
    104104
    105105   const_real_value_traits_ptr real_value_traits_ptr() const
    106    {  return pointer_traits<const_real_value_traits_ptr>::pointer_to(this->get_real_value_traits());  }
     106   {  return boost::intrusive::detail::pointer_to<const_real_value_traits_ptr>(this->get_real_value_traits());  }
    107107
    108108
    109109   typedef tree_iterator<real_value_traits, false> iterator;
  • boost/intrusive/hashtable.hpp

    a b  
    557557      template rebind_pointer<const real_value_traits>::type const_real_value_traits_ptr;
    558558
    559559   const_real_value_traits_ptr real_value_traits_ptr() const
    560    {  return pointer_traits<const_real_value_traits_ptr>::pointer_to(this->priv_real_value_traits());  }
     560   {  return boost::intrusive::detail::pointer_to<const_real_value_traits_ptr>(this->priv_real_value_traits());  }
    561561
    562562   //real_bucket_traits
    563563   //