mercredi 21 août 2019

Why does libc++ not support such a basic atomic operation?

#include <atomic>

int main()
{
    std::atomic_size_t a{ 3 };
    std::atomic_fetch_sub(&a, 1); // vc++ ok, but clang++ failed.
}

The code above is ok by vc++, but failed by clang++ 8.0 with:

clang++ -std=c++2a -stdlib=libc++ main.cpp

error: no matching function for call to 'atomic_fetch_sub'
    std::atomic_fetch_sub(&a, 1);

Why does libc++ not support such a basic atomic operation?

Aucun commentaire:

Enregistrer un commentaire