libstdc++: Implement LWG 3324 for [cmp.alg] function objects (LWG 3324)
authorJonathan Wakely <jwakely@redhat.com>
Thu, 9 Apr 2020 21:24:57 +0000 (22:24 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 9 Apr 2020 21:24:57 +0000 (22:24 +0100)
commit3fd1c229ad10fda68318882329568f400a38fb6d
tree0ea879584b331c2c5af5612db18b60ef67379f8b
parent5b074864f8c593fd4bccee788a023a37b446b2ed
libstdc++: Implement LWG 3324 for [cmp.alg] function objects (LWG 3324)

LWG 3324 changed the [cmp.alg] types to use std::compare_three_way
instead of the <=> operator, but we were still using the old
specification. In order to make the existing tests pass the N::X type
needs to be equality comparable, so that three_way_comparable is
satisfied and compare_three_way can be used.

As part of this change I noticed that the compare_three_way call
operator was unconditionally noexcept, which is incorrect.

* libsupc++/compare (compare_three_way): Fix noexcept-specifier.
(strong_order, weak_order, partial_order): Replace uses of <=> with
compare_three_way function object (LWG 3324).
* testsuite/18_support/comparisons/algorithms/partial_order.cc: Add
equality operator so that X satisfies three_way_comparable.
* testsuite/18_support/comparisons/algorithms/strong_order.cc:
Likewise.
* testsuite/18_support/comparisons/algorithms/weak_order.cc: Likewise.
libstdc++-v3/ChangeLog
libstdc++-v3/libsupc++/compare
libstdc++-v3/testsuite/18_support/comparisons/algorithms/partial_order.cc
libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order.cc
libstdc++-v3/testsuite/18_support/comparisons/algorithms/weak_order.cc