[Boost-bugs] [Boost C++ Libraries] #7627: Problem with auto_buffer implementation

Subject: [Boost-bugs] [Boost C++ Libraries] #7627: Problem with auto_buffer implementation
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-11-02 05:53:58


#7627: Problem with auto_buffer implementation
--------------------------------------+-------------------------------------
 Reporter: amol_ghatge@… | Owner: fmhess
     Type: Bugs | Status: new
Milestone: | Component: signals2
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: |
--------------------------------------+-------------------------------------
 There is problem with auto_buffer implementation, in one of the
 constructors implementation "size" has been used mistakenly to calculate
 buffer's size. Please have a look at the problem area snippet below,

         auto_buffer( size_type size_arg, optimized_const_reference
 init_value,
                      const allocator_type& a )
             : allocator_type( a ),
               members_( (std::max)(size_arg, size_type(N)) ),
               buffer_( allocate(members_.capacity_) ),
               size_( 0 )
         {
             std::uninitialized_fill( buffer_, buffer_ + size, init_value
 );
             size_ = size_arg;
             BOOST_ASSERT( is_valid() );
         }

 Line:std::uninitialized_fill( buffer_, buffer_ + size, init_value );
 Presumably, instead of "size", "size_arg" should have been used.

 Surprisingly this code compiles with gcc and Windows' compiler but clang
 gives an error here.

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