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

Eli Friedman eli.friedman at gmail.com
Thu Apr 19 11:37: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?

Make sure you check out libc++ into llvm/projects/libcxx/, and use
"make install", so clang uses the right libcxx.

We should probably update the "Getting Started" instructions to mention that...

-Eli




More information about the cfe-dev mailing list