File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
tests/std/tests/P0718R2_atomic_smart_ptrs Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -4003,6 +4003,10 @@ public:
4003
4003
store(_STD move(_Value));
4004
4004
}
4005
4005
4006
+ void operator=(nullptr_t) noexcept {
4007
+ store(nullptr);
4008
+ }
4009
+
4006
4010
~atomic() {
4007
4011
const auto _Rep = this->_Repptr._Unsafe_load_relaxed();
4008
4012
if (_Rep) {
Original file line number Diff line number Diff line change 2
2
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3
3
4
4
#include < cassert>
5
+ #include < cstddef>
5
6
#include < cstdint>
6
7
#include < memory>
7
8
#include < thread>
9
+ #include < type_traits>
8
10
#ifdef _DEBUG
9
11
#include < crtdbg.h>
10
12
#endif // _DEBUG
@@ -632,6 +634,13 @@ int main() {
632
634
ensure_member_calls_compile<atomic<shared_ptr<int [2 ][2 ]>>>();
633
635
ensure_member_calls_compile<atomic<weak_ptr<int [2 ][2 ]>>>();
634
636
637
+ // LWG-3893: LWG 3661 broke atomic<shared_ptr<T>> a; a = nullptr;
638
+ static_assert (is_nothrow_assignable_v<atomic<shared_ptr<bool >>, nullptr_t >);
639
+ static_assert (is_nothrow_assignable_v<atomic<shared_ptr<int >>, nullptr_t >);
640
+ static_assert (is_nothrow_assignable_v<atomic<shared_ptr<int []>>, nullptr_t >);
641
+ static_assert (is_nothrow_assignable_v<atomic<shared_ptr<int [][2 ]>>, nullptr_t >);
642
+ static_assert (is_nothrow_assignable_v<atomic<shared_ptr<int [2 ][2 ]>>, nullptr_t >);
643
+
635
644
#ifdef _DEBUG
636
645
sptr0 = {};
637
646
sptr1 = {};
You can’t perform that action at this time.
0 commit comments