[cfe-dev] Using C++11 <atomic> with Clang SVN

Richard Smith richard at metafoo.co.uk
Thu Apr 19 13:33:23 PDT 2012


On Thu, Apr 19, 2012 at 11:29 AM, Matthias Vallentin <vallentin at icir.org>wrote:

> I am having trouble with <atomic> and Clang SVN (Mac OSX Lion). Here is
> the test program:
>
>    #include <atomic>
>
>    int main()
>    {
>        std::atomic_size_t a(0ul);
>        ++a;
>        --a;
>
>        return 0;
>    }
>
> This generates the following error:
>
>    In file included from test.cc:1:
>    /usr/include/c++/v1/atomic:1352:51: error: too few arguments to
> function call, expected 4, have 3
>            {return __atomic_exchange(&__a_, true, __m);}
>                    ~~~~~~~~~~~~~~~~~                 ^
>    /usr/include/c++/v1/atomic:1355:51: error: too few arguments to
> function call, expected 4, have 3
>            {return __atomic_exchange(&__a_, true, __m);}
>                    ~~~~~~~~~~~~~~~~~                 ^
>
> >From the C++11 status page [1], I see that atomic operations (N2427) are
> already supported in the SVN repository, but strong compare and exchange
> (N2748) not yet. Is the above error message occurring due to the lacking
> support for N2748?


No, it results from your libc++ not being new enough.

We do not claim that strong compare-exchange is listed as supported because
the strong/weak distinction is not available in LLVM IR (we always generate
a strong compare-exchange). Maybe we should just mark it as done to avoid
confusion.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120419/41cca37b/attachment.html>


More information about the cfe-dev mailing list