r270965 - in /branches/gcc-8-branch/libstdc++-v...

redi@gcc.gnu.org redi@gcc.gnu.org
Tue May 7 15:46:00 GMT 2019


Author: redi
Date: Tue May  7 15:46:32 2019
New Revision: 270965

URL: https://gcc.gnu.org/viewcvs?rev=270965&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.

Backport from mainline
2019-04-17  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/90105
	* include/bits/forward_list.tcc (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:
    branches/gcc-8-branch/libstdc++-v3/testsuite/23_containers/forward_list/operations/90105.cc
      - copied, changed from r270964, branches/gcc-8-branch/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc
Modified:
    branches/gcc-8-branch/libstdc++-v3/ChangeLog
    branches/gcc-8-branch/libstdc++-v3/include/bits/forward_list.tcc
    branches/gcc-8-branch/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc



More information about the Libstdc++-cvs mailing list