[libc++] Change forward_list::swap to use propagate_on_container_swap for noexcept...
authorHyundeok Park <p.hyundeok76@gmail.com>
Tue, 22 Jun 2021 16:37:51 +0000 (12:37 -0400)
committerLouis Dionne <ldionne.2@gmail.com>
Tue, 22 Jun 2021 16:42:02 +0000 (12:42 -0400)
The current implementation of `std::forward_list::swap` uses
`propagate_on_container_move_assignment` for `noexcept` specification.
This patch changes it to use `propagate_on_container_swap`, as it should.

Fixes https://llvm.org/PR50224.

Differential Revision: https://reviews.llvm.org/D101899

libcxx/include/forward_list

index 086e8ef..9622d9d 100644 (file)
@@ -534,7 +534,7 @@ public:
 #if _LIBCPP_STD_VER >= 14
         _NOEXCEPT;
 #else
-        _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
+        _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
                     __is_nothrow_swappable<__node_allocator>::value);
 #endif
 protected:
@@ -599,7 +599,7 @@ __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
 #if _LIBCPP_STD_VER >= 14
         _NOEXCEPT
 #else
-        _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
+        _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
                     __is_nothrow_swappable<__node_allocator>::value)
 #endif
 {