Boost C++ Libraries: Ticket #12755: serialization/map.hpp tests for the wrong thing to figure out whether emplace_hint() exists https://svn.boost.org/trac10/ticket/12755 <p> Originally from here: <a class="ext-link" href="https://github.com/geodynamics/aspect/issues/1271"><span class="icon">​</span>https://github.com/geodynamics/aspect/issues/1271</a> </p> <p> boost::serialization has this piece of code in serialization/map.hpp: <code></code>` </p> <blockquote> <p> typename Container::iterator result = </p> <blockquote> <p> #ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP </p> <blockquote> <p> s.insert(hint, t.reference()); </p> </blockquote> <p> #else </p> <blockquote> <p> s.emplace_hint(hint, t.reference()); </p> </blockquote> <p> #endif </p> </blockquote> </blockquote> <p> <code></code>` 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): <code></code>` <em> C++0x headers in GCC 4.3.0 and later </em> </p> <table class="wiki"> <tr>#if (BOOST_LIBSTDCXX_VERSION &lt; 40300) <td> !defined(BOOST_LIBSTDCXX11) </td></tr></table> <p> # 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 <code></code>` 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. </p> <p> 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. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12755 Trac 1.4.3 anonymous Thu, 12 Jan 2017 20:08:37 GMT <link>https://svn.boost.org/trac10/ticket/12755#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12755#comment:1</guid> <description> <p> I should correct: the issue is with compilers *before* 4.8. Specifically, we have seen this with gcc 4.7. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Wed, 03 May 2017 21:47:14 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/12755#comment:2 https://svn.boost.org/trac10/ticket/12755#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Robert Ramey</span> to <span class="trac-author">John Maddock</span> </li> </ul> <p> Hmmm - I'm wondering if this shouldn't really be a correction in boost/config.hpp </p> Ticket