[Bug libstdc++/85886] std::atomic<> doesn't have value_type and difference_type
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 24 15:29:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85886
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu May 24 15:28:26 2018
New Revision: 260676
URL: https://gcc.gnu.org/viewcvs?rev=260676&root=gcc&view=rev
Log:
Implement P0558R2 changes to std::atomic
The restrictions forbidding arithmetic on atomic pointer types are only
enabled for C++17 and later, retaining the GNU extension for older
standards. The new nested typedefs and changes to prevent scalar
parameters participating in template argument deduction are enabled
unconditionally.
PR libstdc++/69769
PR libstdc++/85886
* include/bits/atomic_base.h (__atomic_base::value_type)
(__atomic_base::difference_type): Add new typedefs.
* include/std/atomic (atomic<bool>::value_type, atomic<T>::value_type)
(atomic<T*>::value_type, atomic<T*>::difference_type): Likewise.
(atomic<T*>::operator++, atomic<T*>::operator--)
(atomic<T*>::operator+=, atomic<T*>::operator-=)
(atomic<T*>::fetch_add, atomic<T*>::fetch_sub): Add static assertion
to enforce C++17 requirement on pointer arithmetic.
(__atomic_val_t, __atomic_diff_t): New alias templates.
(atomic_init, atomic_store_explicit, atomic_exchange_explicit)
(atomic_compare_exchange_weak_explicit)
(atomic_compare_exchange_strong_explicit, atomic_store)
(atomic_exchange, atomic_compare_exchange_weak)
(atomic_compare_exchange_strong): Use __atomic_val_t to make
scalar parameters be non-deduced contexts.
(atomic_fetch_add_explicit, atomic_fetch_sub_explicit)
(atomic_fetch_add, atomic_fetch_sub): Change first parameter to be
atomic instead of __atomic_base, and use __atomic_diff_t for scalar
parameters.
(atomic_fetch_and_explicit, atomic_fetch_or_explicit)
(atomic_fetch_xor_explicit, atomic_fetch_and, atomic_fetch_or)
(atomic_fetch_xor): Use __atomic_val_t for scalar parameters.
(atomic_fetch_add_explicit, atomic_fetch_sub_explicit)
(atomic_fetch_add, atomic_fetch_sub): Remove overloads for atomic
address types.
* testsuite/29_atomics/atomic/60695.cc: Adjust dg-error lineno.
* testsuite/29_atomics/atomic/69769.cc: New test.
* testsuite/29_atomics/atomic/nonmembers.cc: New test.
* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
Disable test for C++17 and later.
* testsuite/29_atomics/atomic/requirements/typedefs.cc: New test.
* testsuite/29_atomics/atomic_integral/nonmembers.cc: New test.
* testsuite/29_atomics/atomic_integral/requirements/typedefs.cc: New
test.
Added:
trunk/libstdc++-v3/testsuite/29_atomics/atomic/69769.cc
trunk/libstdc++-v3/testsuite/29_atomics/atomic/nonmembers.cc
trunk/libstdc++-v3/testsuite/29_atomics/atomic/requirements/typedefs.cc
- copied, changed from r260635,
trunk/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc
trunk/libstdc++-v3/testsuite/29_atomics/atomic_integral/nonmembers.cc
trunk/libstdc++-v3/testsuite/29_atomics/atomic_integral/requirements/typedefs.cc
- copied, changed from r260635,
trunk/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/atomic_base.h
trunk/libstdc++-v3/include/std/atomic
trunk/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc
trunk/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
More information about the Gcc-bugs
mailing list