[cfe-dev] [PATCH] libc++: help diagnosing the following std::atomic compile error
Howard Hinnant
hhinnant at apple.com
Tue May 21 07:14:25 PDT 2013
On May 21, 2013, at 1:19 AM, Richard Smith <richard at metafoo.co.uk> wrote:
> The patch looks basically right. However, since you get the alignment of the inner object correct, you should pass 0 as the second parameter to __atomic_is_lock_free (that should remove your one remaining link error).
Thanks, that worked.
> Also, your placement-new expressions aren't robust against an overloaded operator& on _Tp.
Ok, thanks:
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
{
::new((void*)&reinterpret_cast<const volatile char&>(__o->__a_)) _Tp(__d);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
{
::new((void*)&reinterpret_cast<const volatile char&>(__o->__a_)) _Tp(__d);
}
Howard
More information about the cfe-dev
mailing list