[gcc r16-9057] libstdc++: Adjust flat_set::swap swapping order

Patrick Palka ppalka@gcc.gnu.org
Thu Jun 4 14:28:45 GMT 2026


https://gcc.gnu.org/g:3297bc3a2440a71f02723ee87eec9b2232991ea5

commit r16-9057-g3297bc3a2440a71f02723ee87eec9b2232991ea5
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri May 29 15:21:06 2026 -0400

    libstdc++: Adjust flat_set::swap swapping order
    
    In r17-908 I accidentally made us swap the comparator first, but we
    decided that the container should be swapped first.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/flat_set (_Flat_set_impl::swap): Swap _M_cont
            first.
    
    (cherry picked from commit f052dcf8699fa650cda20944fdd3a96104b6830c)

Diff:
---
 libstdc++-v3/include/std/flat_set | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/flat_set b/libstdc++-v3/include/std/flat_set
index 2f204cc08bf9..31dce48bbe0a 100644
--- a/libstdc++-v3/include/std/flat_set
+++ b/libstdc++-v3/include/std/flat_set
@@ -680,8 +680,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       {
 	auto __guard = _M_make_clear_guard();
 	auto __guard_y = _ClearGuard{__y._M_cont};
-	ranges::swap(_M_comp, __y._M_comp);
 	ranges::swap(_M_cont, __y._M_cont);
+	ranges::swap(_M_comp, __y._M_comp);
 	__guard._M_disable();
 	__guard_y._M_disable();
       }


More information about the Libstdc++-cvs mailing list