[Boost-bugs] [Boost C++ Libraries] #11692: boost::insert doesn't return a value on the 2 argument overload causing undefined behaviour

Subject: [Boost-bugs] [Boost C++ Libraries] #11692: boost::insert doesn't return a value on the 2 argument overload causing undefined behaviour
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-29 12:24:02


#11692: boost::insert doesn't return a value on the 2 argument overload causing
undefined behaviour
---------------------------------------------+-----------------------
 Reporter: Harry George <harry.m.george@…> | Owner: marshall
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: algorithm
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: boost::insert insert |
---------------------------------------------+-----------------------
 In boost/range/algorithm_ext/insert.hpp the second overload for insert
 doesn't return anything.

 This was causing our build on clang 3.6 to crash. A simple reproducer is


 {{{
 #include <iostream>
 #include <vector>
 #include <set>

 #include <boost/range/algorithm_ext/insert.hpp>

 int main()
 {
         std::vector<int> vec({0,1,2,3});
         std::set<int> out;
         boost::insert(out, vec);
         for (auto val : out) {
                 std::cout << val << std::endl;
         }

         return 0;
 }

 }}}


 To fix it, simply adding


 {{{
   return on;
 }}}

 at the end of the function so that it matches the overload above it fixed
 the issue.

 Having looked at the tests
 https://github.com/boostorg/range/blob/master/test/algorithm_ext_test/insert.cpp

 The test only appear to be testing the overload that takes 3 arguments
 which works fine.

 I tested on 1.56, I had a quick look at the code for 1.59 and it appears
 to have the same issue but have not been able to test it.

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