[Boost-bugs] [Boost C++ Libraries] #12755: serialization/map.hpp tests for the wrong thing to figure out whether emplace_hint() exists

Subject: [Boost-bugs] [Boost C++ Libraries] #12755: serialization/map.hpp tests for the wrong thing to figure out whether emplace_hint() exists
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-01-12 20:02:11


#12755: serialization/map.hpp tests for the wrong thing to figure out whether
emplace_hint() exists
------------------------------+---------------------------
 Reporter: bangerth@… | Owner: ramey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost 1.63.0 | Severity: Regression
 Keywords: |
------------------------------+---------------------------
 Originally from here: https://github.com/geodynamics/aspect/issues/1271

 boost::serialization has this piece of code in serialization/map.hpp:
 ```
         typename Container::iterator result =
             #ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
                 s.insert(hint, t.reference());
             #else
                 s.emplace_hint(hint, t.reference());
             #endif
 ```
 The assumption must have been that BOOST_NO_CXX11_HDR_UNORDERED_MAP is
 indicative of whether std::map has an emplace_hint() function (which is
 new to C++11). The define comes from here
 (boost/config/stdlib/libstdcpp3.hpp):
 ```
 // C++0x headers in GCC 4.3.0 and later
 //
 #if (BOOST_LIBSTDCXX_VERSION < 40300) || !defined(BOOST_LIBSTDCXX11)
 # define BOOST_NO_CXX11_HDR_ARRAY
 # define BOOST_NO_CXX11_HDR_TUPLE
 # define BOOST_NO_CXX11_HDR_UNORDERED_MAP
 # define BOOST_NO_CXX11_HDR_UNORDERED_SET
 # define BOOST_NO_CXX11_HDR_FUNCTIONAL
 #endif
 ```
 The problem is that for GCC 4.8, BOOST_NO_CXX11_HDR_UNORDERED_MAP is not
 set, but the libstdc++ that comes with this compiler still doesn't have
 emplace_hint(). In other words, if one tries to compile something with GCC
 4.8 that calls this function, then it will result in a compiler error.

 The solution is to either exclude the "special" GCC 4.8 in this one
 location and fall back to insert(), or to have some kind of test that is
 actually specific to testing whether or not emplace_hint() exists.

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