<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - atomic<> of trivially copyable class is rejected"
href="http://llvm.org/bugs/show_bug.cgi?id=18097">18097</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>atomic<> of trivially copyable class is rejected
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>hhinnant@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tim@klingt.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>the following code does not compile (taken from
<a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-May/029757.html">http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-May/029757.html</a>):
--
#include <atomic>
#include <type_traits>
struct A
{
int i_;
A(int i) : i_(i) {}
};
static_assert(std::is_trivially_copyable<A>::value, "");
int
main()
{
std::atomic<A> q(A(1));
}
--
gives:
--
/usr/include/c++/v1/atomic:632:58: error: no viable conversion from 'A' to
'_Atomic(A)'
_LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
^ ~~~
/usr/include/c++/v1/atomic:736:51: note: in instantiation of member function
'std::__1::__atomic_base<A, false>::__atomic_base' requested here
_LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {}
^
x.cpp:16:20: note: in instantiation of member function
'std::__1::atomic<A>::atomic' requested here
std::atomic<A> q(A(1));
--
this is a showstopper for compiling boost.lockfree with std::atomic on clang.
more discussions on this issue:
<a href="http://thread.gmane.org/gmane.comp.compilers.clang.devel/29496">http://thread.gmane.org/gmane.comp.compilers.clang.devel/29496</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>