LWG voted this to Tentatively Ready recently.
libstdc++-v3/ChangeLog:
* include/bits/shared_ptr_atomic.h (atomic::operator=(nullptr_t)):
Add overload, as per LWG 3893.
* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
Check assignment from nullptr.
operator=(shared_ptr<_Tp> __desired) noexcept
{ _M_impl.swap(__desired, memory_order_seq_cst); }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 3893. LWG 3661 broke atomic<shared_ptr<T>> a; a = nullptr;
+ void
+ operator=(nullptr_t) noexcept
+ { store(nullptr); }
+
shared_ptr<_Tp>
exchange(shared_ptr<_Tp> __desired,
memory_order __o = memory_order_seq_cst) noexcept
VERIFY( counter == 2 );
}
+void
+test_lwg3893()
+{
+ // LWG 3893. LWG 3661 broke atomic<shared_ptr<T>> a; a = nullptr;
+ std::atomic<std::shared_ptr<int>> a;
+ a = nullptr;
+}
+
int
main()
{
test_atomic_shared_ptr();
test_wait_notify();
test_counting();
+ test_lwg3893();
}