[cfe-dev] libc++: help diagnosing the following std::atomic compile error
Howard Hinnant
hhinnant at apple.com
Mon May 20 15:00:58 PDT 2013
On May 20, 2013, at 5:49 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> One thing to be cautious about:
>
> struct T { char c[3]; };
> static_assert(sizeof(std::atomic<T>) == 3 && alignof(std::atomic<T>) == 1, "under libstdc++");
> static_assert(sizeof(std::atomic<T>) == 4 && alignof(std::atomic<T>) == 4, "under libc++");
Here's what I'm currently testing:
template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
struct __atomic_base // false
{
_ALIGNAS_TYPE(_Atomic(_Tp)) _Tp __a_;
where _ALIGNAS_TYPE(x) will become alignas(x).
Does that look good to you?
Howard
More information about the cfe-dev
mailing list