[Boost-bugs] [Boost C++ Libraries] #10540: missing std::nullptr_t support in boost/type_traits/is_pointer.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #10540: missing std::nullptr_t support in boost/type_traits/is_pointer.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-25 13:50:55


#10540: missing std::nullptr_t support in boost/type_traits/is_pointer.hpp
-------------------------------------------+-------------------------
 Reporter: Stephan Bergmann <sbergman@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: type_traits
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
-------------------------------------------+-------------------------
 ...leads to a failures when inserting a nullptr into a boost::ptr_vector:

 {{{
 $ cat test.cc
 #include "boost/ptr_container/nullable.hpp"
 #include "boost/ptr_container/ptr_vector.hpp"
 void f(boost::ptr_vector<boost::nullable<int>> & v) {
     v.insert(v.begin(), nullptr);
 }

 $ g++ -std=c++11 -c test.cc
 In file included from
 .../boost_1_56_0/boost/ptr_container/nullable.hpp:21:0,
                  from test.cc:1:
 .../boost_1_56_0/boost/mpl/eval_if.hpp: In instantiation of ‘struct
 boost::mpl::eval_if_c<true, boost::range_const_iterator<std::nullptr_t,
 void>, boost::range_mutable_iterator<std::nullptr_t, void> >’:
 .../boost_1_56_0/boost/range/iterator.hpp:69:17: required from ‘struct
 boost::range_iterator<std::nullptr_t, void>’
 .../boost_1_56_0/boost/range/begin.hpp:106:61: required by substitution
 of ‘template<class T> typename boost::range_iterator<const T>::type
 boost::range_adl_barrier::begin(const T&) [with T = std::nullptr_t]’
 .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:43:
 required from ‘typename
 boost::disable_if<boost::ptr_container_detail::is_pointer_or_integral<Range>
>::type boost::ptr_sequence_adapter<T, VoidPtrSeq,
 CloneAllocator>::insert(boost::ptr_sequence_adapter<T, VoidPtrSeq,
 CloneAllocator>::iterator, const Range&) [with Range = std::nullptr_t; T =
 boost::nullable<int>; VoidPtrSeq = std::vector<void*,
 std::allocator<void*> >; CloneAllocator = boost::heap_clone_allocator;
 typename
 boost::disable_if<boost::ptr_container_detail::is_pointer_or_integral<Range>
>::type = void; boost::ptr_sequence_adapter<T, VoidPtrSeq,
 CloneAllocator>::iterator =
 boost::void_ptr_iterator<__gnu_cxx::__normal_iterator<void**,
 std::vector<void*, std::allocator<void*> > >, int>]’
 test.cc:4:32: required from here
 .../boost_1_56_0/boost/mpl/eval_if.hpp:60:31: error: no type named ‘type’
 in ‘boost::mpl::eval_if_c<true,
 boost::range_const_iterator<std::nullptr_t, void>,
 boost::range_mutable_iterator<std::nullptr_t, void> >::f_ {aka struct
 boost::range_const_iterator<std::nullptr_t, void>}’
      typedef typename f_::type type;
                                ^
 In file included from
 .../boost_1_56_0/boost/ptr_container/ptr_vector.hpp:20:0,
                  from test.cc:2:
 .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp: In
 instantiation of ‘typename
 boost::disable_if<boost::ptr_container_detail::is_pointer_or_integral<Range>
>::type boost::ptr_sequence_adapter<T, VoidPtrSeq,
 CloneAllocator>::insert(boost::ptr_sequence_adapter<T, VoidPtrSeq,
 CloneAllocator>::iterator, const Range&) [with Range = std::nullptr_t; T =
 boost::nullable<int>; VoidPtrSeq = std::vector<void*,
 std::allocator<void*> >; CloneAllocator = boost::heap_clone_allocator;
 typename
 boost::disable_if<boost::ptr_container_detail::is_pointer_or_integral<Range>
>::type = void; boost::ptr_sequence_adapter<T, VoidPtrSeq,
 CloneAllocator>::iterator =
 boost::void_ptr_iterator<__gnu_cxx::__normal_iterator<void**,
 std::vector<void*, std::allocator<void*> > >, int>]’:
 test.cc:4:32: required from here
 .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:43:
 error: no matching function for call to ‘begin(std::nullptr_t&)’
              insert( before, boost::begin(r), boost::end(r) );
                                            ^
 .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:43:
 note: candidates are:
 In file included from .../boost_1_56_0/boost/range/functions.hpp:18:0,
                  from
 .../boost_1_56_0/boost/ptr_container/detail/reversible_ptr_container.hpp:29,
                  from
 .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:20,
                  from
 .../boost_1_56_0/boost/ptr_container/ptr_vector.hpp:20,
                  from test.cc:2:
 .../boost_1_56_0/boost/range/begin.hpp:97:55: note: template<class T>
 typename boost::range_iterator<C>::type
 boost::range_adl_barrier::begin(T&)
  inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r )
                                                        ^
 .../boost_1_56_0/boost/range/begin.hpp:97:55: note: template argument
 deduction/substitution failed:
 .../boost_1_56_0/boost/range/begin.hpp:106:61: note: template<class T>
 typename boost::range_iterator<const T>::type
 boost::range_adl_barrier::begin(const T&)
  inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const
 T& r )
                                                              ^
 .../boost_1_56_0/boost/range/begin.hpp:106:61: note: substitution of
 deduced template arguments resulted in errors seen above
 In file included from
 .../boost_1_56_0/boost/ptr_container/ptr_vector.hpp:20:0,
                  from test.cc:2:
 .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:58:
 error: no matching function for call to ‘end(std::nullptr_t&)’
              insert( before, boost::begin(r), boost::end(r) );
                                                           ^
 .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:421:58:
 note: candidates are:
 In file included from .../boost_1_56_0/boost/range/functions.hpp:19:0,
                  from
 .../boost_1_56_0/boost/ptr_container/detail/reversible_ptr_container.hpp:29,
                  from
 .../boost_1_56_0/boost/ptr_container/ptr_sequence_adapter.hpp:20,
                  from
 .../boost_1_56_0/boost/ptr_container/ptr_vector.hpp:20,
                  from test.cc:2:
 .../boost_1_56_0/boost/range/end.hpp:91:55: note: template<class T>
 typename boost::range_iterator<C>::type boost::range_adl_barrier::end(T&)
  inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type end( T& r )
                                                        ^
 .../boost_1_56_0/boost/range/end.hpp:91:55: note: template argument
 deduction/substitution failed:
 .../boost_1_56_0/boost/range/end.hpp:100:61: note: template<class T>
 typename boost::range_iterator<const T>::type
 boost::range_adl_barrier::end(const T&)
  inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type end( const T&
 r )
                                                              ^
 .../boost_1_56_0/boost/range/end.hpp:100:61: note: template argument
 deduction/substitution failed:
 }}}

 What would fix this is:

 {{{
 --- boost/type_traits/is_pointer.hpp 2014-07-09 20:04:22.000000000
 +0200
 +++ boost/type_traits/is_pointer.hpp 2014-09-25 15:37:45.895757102
 +0200
 @@ -72,6 +72,10 @@

 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,::boost::detail::is_pointer_impl<T>::value)

 +#if !defined( BOOST_NO_CXX11_NULLPTR )
 +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pointer,::std::nullptr_t,true)
 +#endif
 +
  #if defined(__BORLANDC__) && !defined(__COMO__) && (__BORLANDC__ < 0x600)
  BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T&,false)
  BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T&
 const,false)
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10540>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC