Boost C++ Libraries: Ticket #8092: stdlibc++ shipped by Apple does not provide std::move https://svn.boost.org/trac10/ticket/8092 <p> After upgrade from Boost 1.52 I get the following error: </p> <pre class="wiki">In file included from /usr/local/include/boost/variant.hpp:17: In file included from /usr/local/include/boost/variant/variant.hpp:31: In file included from /usr/local/include/boost/variant/detail/initializer.hpp:23: /usr/local/include/boost/variant/detail/move.hpp:100:12: error: no member named 'move' in namespace 'std' using std::move; ~~~~~^ </pre><p> This happens because <em>clang -std=c++0x</em> defines __has_feature(cxx_rvalue_references), but libstdc++ doesn't provide std::move. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8092 Trac 1.4.3 Marshall Clow Tue, 19 Feb 2013 14:09:00 GMT <link>https://svn.boost.org/trac10/ticket/8092#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:1</guid> <description> <p> You might want to check out this blog post that I wrote about clang and C++11, which addresses this very topic: </p> <p> <a class="ext-link" href="http://marshall.calepin.co/llvmclang-and-standard-libraries-on-mac-os-x.html"><span class="icon">​</span>http://marshall.calepin.co/llvmclang-and-standard-libraries-on-mac-os-x.html</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 23 Feb 2013 19:21:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:2</guid> <description> <p> marshall, </p> <p> Thank you, I've read about this on stackoverflow. I see two problems here: Firstly, switching to libc++ means that end-user will have to compile boost with libc++ interfaces instead of using binary packages. And secondly, not any C++11 code will compile against libc++ as is. </p> <p> I believe the problem can be solved with a few directives in <code>config/stdlib/libstdcpp3.hpp</code> like </p> <pre class="wiki">// C++11 features in libstdc++ shipped with Apple Clang #if __APPLE__ &amp;&amp; (__GNUC_LIBSTD__ &lt;= 4) &amp;&amp; (__GNUC_LIBSTD_MINOR__ &lt;= 2) # define BOOST_NO_CXX11_RVALUE_REFERENCES #endif </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 25 Feb 2013 09:14:40 GMT</pubDate> <title>owner, component, severity, summary changed https://svn.boost.org/trac10/ticket/8092#comment:3 https://svn.boost.org/trac10/ticket/8092#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">ebf</span> to <span class="trac-author">John Maddock</span> </li> <li><strong>component</strong> <span class="trac-field-old">variant</span> → <span class="trac-field-new">config</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Regression</span> → <span class="trac-field-new">Showstopper</span> </li> <li><strong>summary</strong> <span class="trac-field-old">Apple clang does not provide std::move</span> → <span class="trac-field-new">stdlibc++ shipped by Apple does not provide std::move</span> </li> </ul> <p> So it seems like it is not a regression in Boost.Variant, but a small problem with Boost.Config. </p> Ticket John Maddock Sun, 03 Mar 2013 13:33:51 GMT cc set https://svn.boost.org/trac10/ticket/8092#comment:4 https://svn.boost.org/trac10/ticket/8092#comment:4 <ul> <li><strong>cc</strong> <span class="trac-author">mimomorin@…</span> added </li> </ul> <p> I'd rather not disable rvalue ref support as it disables a lot of functionality in other libraries which use rvalue refs but not std::move/forward. </p> <p> There are a number of solutions, none of which are really very nice: </p> <ul><li>Declare this combination of compiler/stdlib as unsupported - either the user has to manually define BOOST_NO_CXX11_RVALUE_REFERENCES when they hit this (probably breaks other stuff) or switch to a supported configuration. </li><li>Add yet another config macro for std::move/forward. Unfortunately this is not as easy as it looks as there is no easy correspondence between libstdc++ versions and features (normally the GCC version gives us that, but using clang messes that up as well). </li><li>Add our own std::move/forward as a workaround - but this shares the configuration hell we have in the above case as well. </li><li>Suggest library authors use boost::move - but may be a heavyweight solution? </li><li>Suggest library authors use simple type casts (to rvalue reference) rather than std::move - but this uglifies code. </li></ul><p> So... my inclination is to say "won't fix", but I'd welcome other ideas. </p> <p> Also adding Michel Morin into this as he's edited clang.hpp quite a bit. </p> Ticket Marshall Clow Sun, 03 Mar 2013 19:49:23 GMT <link>https://svn.boost.org/trac10/ticket/8092#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:5</guid> <description> <p> There's a clang-darwin config that we ship. (tools/build/v2/tools/clang-darwin.jam) Shouldn't these changes (whatever they turn out to be) go in there instead? (since the situation is particular to Mac OS X) </p> <p> Note that there is at least one bug vs. the clang-darwin toolset. (<a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5957" title="#5957: Bugs: Boost 1.41.0 can't build on Mac OS X 10.7 (closed: wontfix)">#5957</a>) [ Yeah, someone added a comment to a closed ticket. Really should be it's own ticket - but read the last comment ] </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Michel Morin</dc:creator> <pubDate>Mon, 04 Mar 2013 08:40:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:6</guid> <description> <p> Detecting the clang and libstdc++-4.2 configuration is not so difficult. (I needed to detect it in <code>boost/type_traits/intrinsics.hpp</code> to avoid the problems about <code>__is_pod</code>/<code>__is_empty</code>.) But I don't want to disable rvalue refs, since the compiler does support the feature. </p> <p> Another solutions would be to use workaround implementations, but </p> <ul><li>We cannot add workaround implementations of <code>std::move/forward</code> as <code>boost::move/forward</code>, since the name <code>boost::move/forward</code> is already used by the Boost.Move library. </li><li>We cannot use <code>boost::forward</code> in Boost.Move as a drop-in replacement of <code>std::forward</code>, since <code>boost::forward</code> is not equivalent to <code>std::forward</code>. We cannot use <code>static_cast&lt;T&amp;&amp;&gt;</code> either, due to the same reason. </li></ul><p> I don't think it's worth the effort to support this configuration. I would say "Don't turn on -std=c++0x option in this configuration or use another stdlib that supports C++11." </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Michel Morin</dc:creator> <pubDate>Mon, 04 Mar 2013 09:36:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:7</guid> <description> <blockquote class="citation"> <p> We cannot use <code>static_cast&lt;T&amp;&amp;&gt;</code> either, due to the same reason. </p> </blockquote> <p> I meant that <code>std::forward&lt;T&gt;(x)</code> is not always replaceable with <code>static_cast&lt;T&amp;&amp;&gt;(x)</code>. See, for example, N2951. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Sebastian Redl</dc:creator> <pubDate>Mon, 04 Mar 2013 11:42:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:8</guid> <description> <p> If Clang + libstdc++4.2 is detectable, then adding our own std::forward/std::move seems by far the best solution. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 04 Mar 2013 17:20:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:9</guid> <description> <p> So a possible fix would be to add: </p> <pre class="wiki">#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \ &amp;&amp; defined(__APPLE__) &amp;&amp; defined(_GLIBCXX_VERSION) \ &amp;&amp; (_GLIBCXX_VERSION &lt;= 20070719) // move and forward go here #endif </pre><p> But where do we add this? The obvious place is in config/suffix.hpp but as move/forward depend on remove_reference that's a really bad idea (cyclic dependencies etc). Does clang have an intrinsic for remove_reference? If so we could make it a clang specific fix in clang.hpp I guess... </p> <p> John. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Mon, 04 Mar 2013 17:48:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:10</guid> <description> <p> As people propose solutions, I want everyone to keep in mind: </p> <blockquote> <p> This is not a "clang problem". This is a "clang on Mac OS X when used with the old version of libstdc++ that Apple ships" problem. If you have a modern libstdc++, this is not a problem. If you use libc++, this is not a problem. </p> </blockquote> <p> Any solution should should be very constrained, so as not to break other systems - hence my suggestion earlier to consider the <code>clang-darwin</code> toolset. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Michel Morin</dc:creator> <pubDate>Mon, 04 Mar 2013 18:46:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:11</guid> <description> <p> Do we really need to detect the clang and libstdc++-4.2 configuration? </p> <p> What's the problem of always using Boost versions of <code>move</code>/<code>forward</code> </p> <pre class="wiki">template &lt;typename T&gt; inline T&amp;&amp; forward(typename boost::remove_reference&lt;T&gt;::type&amp; t) BOOST_NOEXCEPT { return static_cast&lt;T&amp;&amp;&gt;(t); } template &lt;typename T&gt; inline T&amp;&amp; forward(typename boost::remove_reference&lt;T&gt;::type&amp;&amp; t) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT(!boost::is_lvalue_reference&lt;T&gt;::value); return static_cast&lt;T&amp;&amp;&gt;(t); } template &lt;typename T&gt; inline typename boost::remove_reference&lt;T&gt;::type&amp;&amp; move(T&amp;&amp; t) BOOST_NOEXCEPT { return static_cast&lt;typename boost::remove_reference&lt;T&gt;::type&amp;&amp;&gt;(t); } </pre><p> ? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 18 Apr 2013 16:05:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:12</guid> <description> <blockquote class="citation"> <p> What's the problem of always using Boost versions of move/forward </p> </blockquote> <p> Well it means changing a lot of library's code, in order to support a compiler/stdlib configuration that's basically broken and isn't itself supported by it's vendors. </p> <p> My gut feeling is to close this as "won't fix", Marshall you're more familiar with this platform than I am, is that reasonable? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 09 Jun 2013 19:38:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:13</guid> <description> <p> I believed that we decided to don't support this combination. </p> <p> + 1 do "won't fix" </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Sun, 09 Jun 2013 20:06:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8092#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:14</guid> <description> <p> I concur with "won't fix". </p> <p> If you want to use C++11 stuff on Mac OS X, use a C++11 compliant compiler _and_ a C++11 library. (aka clang and libc++). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 12 Jun 2013 21:20:00 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8092#comment:15 https://svn.boost.org/trac10/ticket/8092#comment:15 <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">wontfix</span> </li> </ul> Ticket koala0xcafe Thu, 19 Sep 2013 00:03:15 GMT <link>https://svn.boost.org/trac10/ticket/8092#comment:16 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8092#comment:16</guid> <description> <p> that's due to the weirdo support of 2010 kind of inner faulty bridge, if set your target to cxx98 or fully built against cx11 there is no issue, this bug should be sent at Apple with the dedicated mention "swap your arse guys", numerous issues are logged because of the new itunes e.g xcode 4 which is a mess, buggy and a robbery. </p> </description> <category>Ticket</category> </item> </channel> </rss>