[Boost-bugs] [Boost C++ Libraries] #11627: small_vector<T, n>::swap( ) appears to be broken

Subject: [Boost-bugs] [Boost C++ Libraries] #11627: small_vector<T, n>::swap( ) appears to be broken
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-08 22:05:57


#11627: small_vector<T,n>::swap( ) appears to be broken
----------------------------------+------------------------
 Reporter: benjamin.redelings@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.59.0 | Severity: Problem
 Keywords: |
----------------------------------+------------------------
 The small_vector class seems like it could be really useful! However, it
 seems to have a broken implementation of the swap( ) member function.

 The first test case creates a small_vector<int,10> of size 2. Swapping
 fails to clear the vector that is swapped from.

 bredelings_at_transposon:~/Devel/bali-phy/master$ g++ test.C -I
 boost/include/ -std=c++14
 bredelings_at_transposon:~/Devel/bali-phy/master$ ./a.out
 v.size() = 2 w.size() = 0
  swapping v and w ...
 v.size() = 2 w.size() = 2


 The second test case creates a small_vector<int,10> of size 11. Swapping
 seems to work, but apparently corrupts the heap:

 bredelings_at_transposon:~/Devel/bali-phy/master$ g++ test2.C -I
 boost/include/ -std=c++14
 bredelings_at_transposon:~/Devel/bali-phy/master$ ./a.out
 v.size() = 11 w.size() = 0
  swapping v and w ...
 v.size() = 0 w.size() = 11
 *** Error in `./a.out': munmap_chunk(): invalid pointer:
 0x00007ffd88feb978 ***
 Aborted

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