Update atomic feature macros, synopsis, signatures to match C++20. Improve test coverage for non-lock-free atomics.
Description
Description
Details
Details
- Committed
__simt__ Sep 9 2020, 10:00 AM - Parents
- rG4b15fc9ddb4d: [NFC][MLInliner] Don't initialize in an assert.
- Branches
- Unknown
- Tags
Event Timeline
Comment Actions
Hi Olivier,
Prior versions of the C++ standard (11, 14, 17) required more specialized templates for atomic_fetch_{add,sub}[_explicit] for pointers. E.g.:
template <class T> T atomic_fetch_add(atomic<T>*, T) noexcept; template <class T> T* atomic_fetch_add(atomic<T*>*, ptrdiff_t) noexcept;
Implementing them as a single template breaks the following code (when compiled as C++17):
#include <atomic> void test() { std::atomic<int*> a; std::atomic_fetch_add<int>(&a, 1); }
Could you please partially revert this commit and use the previous implementation of atomic_fetch_{add,sub}[_explicit] and only use the new implementation when compiling as C++20 and later?