Boost C++ Libraries: Ticket #11875: Boost.Phoenix should not forward-declare std::unordered_set / map https://svn.boost.org/trac10/ticket/11875 <p> Boost 1.60 introduced the header boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp. </p> <p> When building on Linux with libstdc++ debug mode (-DGLIBCXX_DEBUG) this causes ambiguous references to the forward-declared classes because in libstdc++ side, they now live in the std::<span class="underline">debug namespace instead. </span></p> <p> The following test cases triggers it : </p> <pre class="wiki"> #include &lt;boost/spirit/include/phoenix.hpp&gt; #include &lt;unordered_map&gt; void f() { std::unordered_map&lt;int, float&gt; map; } </pre><p> when built with </p> <p> <code> g++ -std=c++11 -D_GLIBCXX_DEBUG=1 -c problem.cpp </code> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11875 Trac 1.4.3 Braden McDaniel <braden@…> Wed, 10 Feb 2016 21:28:52 GMT cc set https://svn.boost.org/trac10/ticket/11875#comment:1 https://svn.boost.org/trac10/ticket/11875#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">braden@…</span> added </li> </ul> <p> There are other problems with this, as well, using gcc/libstdc++ (4.9, at least). For instance, this template specialization fails to compile if the problem Phoenix header gets included: </p> <div class="wiki-code"><div class="code"><pre><span class="k">template</span> <span class="o">&lt;</span><span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="k">typename</span> <span class="n">TypeT</span><span class="p">,</span> <span class="k">typename</span> <span class="n">KeyT</span><span class="p">,</span> <span class="k">typename</span> <span class="n">HashT</span><span class="p">,</span> <span class="k">typename</span> <span class="n">KeyEqualT</span><span class="p">,</span> <span class="k">typename</span> <span class="n">AllocatorT</span><span class="o">&gt;</span> <span class="k">class</span> <span class="nc">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">unordered_map</span><span class="o">&lt;</span><span class="n">KeyT</span><span class="p">,</span> <span class="n">TypeT</span><span class="p">,</span> <span class="n">HashT</span><span class="p">,</span> <span class="n">KeyEqualT</span><span class="p">,</span> <span class="n">AllocatorT</span><span class="o">&gt;</span> <span class="o">&gt;</span> <span class="p">{};</span> </pre></div></div><p> For the time being, I'm simply compiling my code with <code>BOOST_PHOENIX_USING_LIBCPP</code> defined, as this disables the forward declarations. But this is obviously undesirable if that macro ever gets used for something that is actually libc++-specific. </p> Ticket Jean-Michaël Celerier Sat, 09 Apr 2016 12:35:31 GMT <link>https://svn.boost.org/trac10/ticket/11875#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11875#comment:2</guid> <description> <p> Got another similar problem (in boost 1.60) in <code>boost/phoenix/stl/algorithm/detail/is_unordered_set_or_map.hpp</code> . The BOOST_PHOENIX_USING_LIBCPP trick seems to work however. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Kohei Takahashi</dc:creator> <pubDate>Tue, 15 Nov 2016 14:38:28 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/11875#comment:3 https://svn.boost.org/trac10/ticket/11875#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.62.0</span> </li> </ul> <p> This should be fixed in 1.62 release (<a class="ext-link" href="https://github.com/boostorg/phoenix/pull/33"><span class="icon">​</span>https://github.com/boostorg/phoenix/pull/33</a>). </p> Ticket rogeeff@… Fri, 19 May 2017 19:05:56 GMT status, version, milestone changed; resolution deleted https://svn.boost.org/trac10/ticket/11875#comment:4 https://svn.boost.org/trac10/ticket/11875#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.60.0</span> → <span class="trac-field-new">Boost 1.64.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.62.0</span> → <span class="trac-field-new">Boost 1.65.0</span> </li> </ul> <p> This is still wrong. There is no legal way to forward declare std::unordered_set/std::unordered_map. According to the standard ([namespace.std]), these forward declarations have undefined behavior. </p> <p> This need to change to </p> <blockquote> <p> #include &lt;unordered_map&gt; #include &lt;unordered_set&gt; </p> </blockquote> Ticket Kohei Takahashi Wed, 31 May 2017 15:23:56 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11875#comment:5 https://svn.boost.org/trac10/ticket/11875#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> OK, fwd-decl will be replaced with include by <a class="ext-link" href="https://github.com/boostorg/phoenix/pull/54"><span class="icon">​</span>https://github.com/boostorg/phoenix/pull/54</a>. </p> Ticket