--- a/boost/intrusive/pointer_traits.hpp 2013-11-21 17:10:28.000000000 +0400 +++ b/boost/intrusive/pointer_traits.hpp 2013-11-27 16:03:15.657580336 +0400 @@ -257,7 +257,37 @@ { return dynamic_cast(uptr); } }; -} //namespace container { +namespace detail { + +// NOTE: These functions help to alleviate a GCC 4.7.2 bug on Debian Wheezy, when the compiler instantiates +// pointer_traits on an incorrect pointer type. The compiler looses const qualifier from the element type +// of the pointer (i.e. it instantiates pointer_traits instead of pointer_traits). +template< typename To, typename From > +inline To static_cast_ptr(From const& p) +{ + return pointer_traits< To >::static_cast_from(p); +} + +template< typename To, typename From > +inline To const_cast_ptr(From const& p) +{ + return pointer_traits< To >::const_cast_from(p); +} + +template< typename To, typename From > +inline To dynamic_cast_ptr(From const& p) +{ + return pointer_traits< To >::dynamic_cast_from(p); +} + +template< typename Ptr > +inline typename pointer_traits< Ptr >::pointer pointer_to(typename pointer_traits< Ptr >::reference obj) +{ + return pointer_traits< Ptr >::pointer_to(obj); +} + +} //namespace detail { +} //namespace intrusive { } //namespace boost { #include --- a/boost/intrusive/detail/list_node.hpp 2013-11-21 17:10:29.000000000 +0400 +++ b/boost/intrusive/detail/list_node.hpp 2013-11-27 14:23:27.581808157 +0400 @@ -109,7 +109,7 @@ { members_.nodeptr_ = node; return static_cast(*this); } const_real_value_traits_ptr get_real_value_traits() const - { return pointer_traits::static_cast_from(members_.get_ptr()); } + { return boost::intrusive::detail::static_cast_ptr(members_.get_ptr()); } public: list_iterator& operator++() --- a/boost/intrusive/detail/slist_node.hpp 2013-11-21 17:10:29.000000000 +0400 +++ b/boost/intrusive/detail/slist_node.hpp 2013-11-27 14:23:53.470011717 +0400 @@ -98,7 +98,7 @@ { members_.nodeptr_ = node; return static_cast(*this); } const_real_value_traits_ptr get_real_value_traits() const - { return pointer_traits::static_cast_from(members_.get_ptr()); } + { return boost::intrusive::detail::static_cast_ptr(members_.get_ptr()); } public: slist_iterator& operator++() --- a/boost/intrusive/detail/tree_node.hpp 2013-11-21 17:10:29.000000000 +0400 +++ b/boost/intrusive/detail/tree_node.hpp 2013-11-27 14:24:13.742170798 +0400 @@ -165,7 +165,7 @@ const_real_value_traits_ptr get_real_value_traits() const { - return pointer_traits::static_cast_from(members_.get_ptr()); + return boost::intrusive::detail::static_cast_ptr(members_.get_ptr()); } tree_iterator end_iterator_from_it() const --- a/boost/intrusive/list.hpp 2013-11-21 17:10:28.000000000 +0400 +++ b/boost/intrusive/list.hpp 2013-11-27 15:40:43.162525998 +0400 @@ -180,7 +180,7 @@ typedef typename pointer_traits::template rebind_pointer::type const_real_value_traits_ptr; const_real_value_traits_ptr real_value_traits_ptr() const - { return pointer_traits::pointer_to(this->get_real_value_traits()); } + { return boost::intrusive::detail::pointer_to(this->get_real_value_traits()); } //! Effects: constructs an empty list. //! --- a/boost/intrusive/slist.hpp 2013-11-21 17:10:28.000000000 +0400 +++ b/boost/intrusive/slist.hpp 2013-11-27 15:43:37.911939991 +0400 @@ -271,7 +271,7 @@ typedef typename pointer_traits::template rebind_pointer::type const_real_value_traits_ptr; const_real_value_traits_ptr real_value_traits_ptr() const - { return pointer_traits::pointer_to(this->get_real_value_traits()); } + { return boost::intrusive::detail::pointer_to(this->get_real_value_traits()); } public: --- a/boost/intrusive/bstree.hpp 2013-11-21 17:10:28.000000000 +0400 +++ b/boost/intrusive/bstree.hpp 2013-11-27 15:43:06.583686828 +0400 @@ -103,7 +103,7 @@ typedef typename pointer_traits::template rebind_pointer::type const_real_value_traits_ptr; const_real_value_traits_ptr real_value_traits_ptr() const - { return pointer_traits::pointer_to(this->get_real_value_traits()); } + { return boost::intrusive::detail::pointer_to(this->get_real_value_traits()); } typedef tree_iterator iterator; --- a/boost/intrusive/hashtable.hpp 2013-11-21 17:10:28.000000000 +0400 +++ b/boost/intrusive/hashtable.hpp 2013-11-27 15:44:07.528179843 +0400 @@ -557,7 +557,7 @@ template rebind_pointer::type const_real_value_traits_ptr; const_real_value_traits_ptr real_value_traits_ptr() const - { return pointer_traits::pointer_to(this->priv_real_value_traits()); } + { return boost::intrusive::detail::pointer_to(this->priv_real_value_traits()); } //real_bucket_traits //