https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90105
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Wed Apr 17 21:47:20 2019 New Revision: 270427 URL: https://gcc.gnu.org/viewcvs?rev=270427&root=gcc&view=rev Log: PR libstdc++/90105 make forward_list::sort stable While testing the fix I also discovered that operator== assumes the elements are comparable with operator!= which is not required. PR libstdc++/90105 * include/bits/forward_list.h (operator==): Do not use operator!= to compare elements. (forward_list<T, A>::sort(Comp)): When elements are equal take the one earlier in the list, so that sort is stable. * testsuite/23_containers/forward_list/operations/90105.cc: New test. * testsuite/23_containers/forward_list/comparable.cc: Test with types that meet the minimum EqualityComparable and LessThanComparable requirements. Remove irrelevant comment. Added: trunk/libstdc++-v3/testsuite/23_containers/forward_list/operations/90105.cc - copied, changed from r270425, trunk/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/forward_list.tcc trunk/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc