Boost C++ Libraries: Ticket #8593: enable std::atomic with clang / libc++ https://svn.boost.org/trac10/ticket/8593 <p> Attatched is a simple patch that checks if we're usng a version of clang / libc++ that has &lt;atomic&gt; support. </p> <p> The: </p> <pre class="wiki">#if defined(_LIBCPP_VERSION) &amp;&amp; __has_include( &lt;atomic&gt; ) </pre><p> is on a second line because I previously had problems with the <span class="underline">has_include( &lt;&gt; ) macro when this code is interpreted by MSVC compiler - it seems to want to process the entire line despite the first check failing. </span></p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8593 Trac 1.4.3 reakinator@… Sun, 19 May 2013 23:51:28 GMT attachment set https://svn.boost.org/trac10/ticket/8593 https://svn.boost.org/trac10/ticket/8593 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">lockfree_atomic_libcpp.patch</span> </li> </ul> <p> lockfree/detail/atomic.hpp patch enabling &lt;atomic&gt; for libc++ </p> Ticket timblechmann Mon, 20 May 2013 08:22:57 GMT <link>https://svn.boost.org/trac10/ticket/8593#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8593#comment:1</guid> <description> <p> unfortunately this does not work on linux: </p> <pre class="wiki">/usr/include/c++/v1/atomic:623:58: error: no viable conversion from 'boost::lockfree::detail::tagged_index' to '_Atomic(boost::lockfree::detail::tagged_index)' _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {} ^ ~~~ /usr/include/c++/v1/atomic:727:51: note: in instantiation of member function 'std::__1::__atomic_base&lt;boost::lockfree::detail::tagged_index, false&gt;::__atomic_base' requested here _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {} ^ ../../../boost/lockfree/detail/freelist.hpp:404:9: note: in instantiation of member function 'std::__1::atomic&lt;boost::lockfree::detail::tagged_index&gt;::atomic' requested here pool_(tagged_index(static_cast&lt;index_t&gt;(count), 0)) ^ </pre> </description> <category>Ticket</category> </item> <item> <author>reakinator@…</author> <pubDate>Mon, 20 May 2013 16:59:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8593#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8593#comment:2</guid> <description> <p> Agh, as luck would have it I'm only using lockfree::spsc_queue, which doesn't have this problem (both lockfree stack and queue do). </p> <p> Can you tell why the conversion can't be made? libc++ is known to be pretty strict with standards (more than gcc), but hopefully we can narrow down what needs to be fixed. </p> </description> <category>Ticket</category> </item> <item> <author>reakinator@…</author> <pubDate>Mon, 20 May 2013 19:58:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8593#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8593#comment:3</guid> <description> <p> I found the following thread when doing some research: </p> <p> <a class="ext-link" href="http://clang-developers.42468.n3.nabble.com/RFC-atomic-support-for-gcc-4-7-compatibility-td3900609.html"><span class="icon">​</span>http://clang-developers.42468.n3.nabble.com/RFC-atomic-support-for-gcc-4-7-compatibility-td3900609.html</a> </p> <p> My hunch is that point 2 on that list ("relax the requirement to the type being either _Atomic or trivially copyable") was not implemented, or tagged_ptr is not trivially copyable. </p> </description> <category>Ticket</category> </item> <item> <author>Richard Eakin <reakinator@…></author> <pubDate>Tue, 21 May 2013 04:15:25 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8593#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8593#comment:4</guid> <description> <p> Hm, appears it is a clang bug, H.Hinnant submitted a patch a few hours after I reported it... </p> <p> <a class="ext-link" href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-May/029771.html"><span class="icon">​</span>http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-May/029771.html</a> </p> <p> I guess this has to go on the back burner for now... when there is a way to verify we are using the updated version of libc++, I'll update. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>timblechmann</dc:creator> <pubDate>Tue, 21 May 2013 07:36:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8593#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8593#comment:5</guid> <description> <p> gcc used to have the same problem ... hopefully this patch makes it into a libc++ release in the near future ... until then, boost.atomic is the way to go ... </p> </description> <category>Ticket</category> </item> </channel> </rss>