e4379a931d
This implements the new requirements for C++20 that std::atomic should initialize the atomic variable in its default constructor. This patch does not add the deprecated attribute to atomic_init, but that should be done at some point as it's deprecated in C++20. The paper also deprecates the ATOMIC_FLAG_INIT macro, although we can't apply the deprecated attribute to a macro. PR libstdc++/58605 * include/bits/atomic_base.h (__cpp_lib_atomic_value_initialization): Define. (__atomic_flag_base, __atomic_base, __atomic_base<_PTp*>) (__atomic_float): Add default member initializer for C++20. * include/std/atomic (atomic): Likewise. (atomic::atomic()): Remove noexcept-specifier on default constructor. * include/std/version (__cpp_lib_atomic_value_initialization): Define. * testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust dg-error line number. * testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise. * testsuite/29_atomics/atomic/cons/value_init.cc: New test. * testsuite/29_atomics/atomic_flag/cons/value_init.cc: New test. * testsuite/29_atomics/atomic_flag/requirements/trivial.cc: Adjust expected result for is_trivially_default_constructible. * testsuite/29_atomics/atomic_float/requirements.cc: Likewise. * testsuite/29_atomics/atomic_float/value_init.cc: New test. * testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Likewise. * testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Likewise. * testsuite/29_atomics/atomic_integral/cons/value_init.cc * testsuite/29_atomics/atomic_integral/requirements/trivial.cc: Adjust expected results for is_trivially_default_constructible. * testsuite/util/testsuite_common_types.h (has_trivial_dtor): Add new test generator. |
||
---|---|---|
.. | ||
algorithm | ||
any | ||
array | ||
atomic | ||
bit | ||
bitset | ||
charconv | ||
chrono | ||
codecvt | ||
complex | ||
concepts | ||
condition_variable | ||
deque | ||
execution | ||
filesystem | ||
forward_list | ||
fstream | ||
functional | ||
future | ||
iomanip | ||
ios | ||
iosfwd | ||
iostream | ||
istream | ||
iterator | ||
limits | ||
list | ||
locale | ||
map | ||
memory | ||
memory_resource | ||
mutex | ||
numbers | ||
numeric | ||
optional | ||
ostream | ||
queue | ||
random | ||
ranges | ||
ratio | ||
regex | ||
scoped_allocator | ||
set | ||
shared_mutex | ||
span | ||
sstream | ||
stack | ||
stdexcept | ||
stop_token | ||
streambuf | ||
string | ||
string_view | ||
system_error | ||
thread | ||
tuple | ||
type_traits | ||
typeindex | ||
unordered_map | ||
unordered_set | ||
utility | ||
valarray | ||
variant | ||
vector | ||
version |