This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This implements the significant changes from P0558R1 for C++17, adding nested typedefs and making it ill-formed to do arithmetic on std::atomic<T*> if !is_object<T>::value. We currently support such arithmetic for std::atomic<void*>, and even have a test checking it, so I've only made it ill-formed for C++17 mode. I'd like to deprecate that extension for GCC 8 and make it ill-formed in all modes at some point. PR 69769 points out that we also allow that arithmetic for pointers to functions, which is just crazy. The unimplemented parts of the paper are changing the non-member functions to use the new std::atomic<T>::value_type and std::atomic<T>::difference_type types for the parameters, so they are non-deduced contexts. That would be too big a change to make now, so we can revisit that for GCC 8 too. PR libstdc++/69769 * include/bits/atomic_base.h (__atomic_base): Add new typedefs for C++17. * include/std/atomic (atomic<bool>, atomic<T>, atomic<T*>): 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. * testsuite/29_atomics/atomic/60695.cc: Adjust dg-error lineno. * testsuite/29_atomics/atomic/69769.cc: New test. * testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: Disable test for C++17. * testsuite/29_atomics/atomic/requirements/typedefs.cc: New test. * testsuite/29_atomics/atomic_integral/requirements/typedefs.cc: New test. Tested powerpc64le-linux, with all -std=gnu++?? options. I plan to commit this tomorrow.
Attachment:
patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |