libstdc++: Add std::atomic<shared_ptr>(nullptr_t) constructor (LWG 3661)
This DR was approved at the February 2022 plenary. libstdc++-v3/ChangeLog: * include/bits/shared_ptr_atomic.h (atomic<shared_ptr>): Add constructor for constant initialization from nullptr_t. * testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc: Check for new constructor.
This commit is contained in:
parent
e3c5e8360b
commit
41ccd683f0
@ -573,6 +573,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
constexpr atomic() noexcept = default;
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 3661. constinit atomic<shared_ptr<T>> a(nullptr); should work
|
||||
constexpr atomic(nullptr_t) noexcept : atomic() { }
|
||||
|
||||
atomic(shared_ptr<_Tp> __r) noexcept
|
||||
: _M_impl(std::move(__r))
|
||||
{ }
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
// Check constexpr constructor.
|
||||
constinit std::atomic<std::shared_ptr<int>> a;
|
||||
// LWG 3661. constinit atomic<shared_ptr<T>> a(nullptr); should work
|
||||
constinit std::atomic<std::shared_ptr<int>> a2 = nullptr;
|
||||
|
||||
void
|
||||
test_is_lock_free()
|
||||
|
Loading…
Reference in New Issue
Block a user