[Boost-bugs] [Boost C++ Libraries] #6981: Can't use boost::ptr_vector<T>::auto_type as data member in GCC 4.6

Subject: [Boost-bugs] [Boost C++ Libraries] #6981: Can't use boost::ptr_vector<T>::auto_type as data member in GCC 4.6
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-06-12 03:56:20


#6981: Can't use boost::ptr_vector<T>::auto_type as data member in GCC 4.6
---------------------------------------------+------------------------------
 Reporter: Shuo Chen <giantchen@…> | Owner: nesotto
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: ptr_container
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: |
---------------------------------------------+------------------------------
 The following code failed to compile with g++ 4.6.3 on Ubuntu Linux 12.04
 LTS.

 {{{
 #include <boost/noncopyable.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>

 class Test : boost::noncopyable
 {
 };

 class Pool : boost::noncopyable
 {
  public:
   Pool();

  private:
   boost::ptr_vector<Test>::auto_type p_;
 };

 Pool::Pool()
 {
 }
 }}}

 the error is
 {{{
 In file included from
 /usr/include/boost/ptr_container/detail/reversible_ptr_container.hpp:22:0,
                  from
 /usr/include/boost/ptr_container/ptr_sequence_adapter.hpp:20,
                  from /usr/include/boost/ptr_container/ptr_vector.hpp:20,
                  from ptr_vec.cc:2:
 /usr/include/boost/ptr_container/detail/static_move_ptr.hpp:
 In instantiation of 'boost::ptr_container_detail::static_move_ptr<Test,
 boost::ptr_container_detail::clone_deleter<...> >
 ::cant_move_from_const<const
 boost::ptr_container_detail::static_move_ptr<Test,
 boost::ptr_container_detail::clone_deleter<...> > >':
 ptr_vec.cc:17:12: instantiated from here
 /usr/include/boost/ptr_container/detail/static_move_ptr.hpp:168:57: error:
 no type named 'error' in 'class
 boost::ptr_container_detail::static_move_ptr<Test,
 boost::ptr_container_detail::clone_deleter<boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<Test,
 std::vector<void*, std::allocator<void*> > >,
 boost::heap_clone_allocator>::null_clone_allocator<false> > >'
 }}}

 However, if I inline the constructor, it compiles fine.

 {{{
 class PoolOkay : boost::noncopyable
 {
  public:
   PoolOkay()
   {
     // okay to inline constructor
   }

  private:
   boost::ptr_vector<Test>::auto_type p_;
 };
 }}}

 Note: there is no error when compiling with g++ 4.4.3

 I am not sure if it's a bug of ptr_container or gcc itself.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6981>
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:09 UTC