diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2219a0f0d8a..0ca4e9e5cc4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2017-09-21 Jonathan Wakely + + * testsuite/25_algorithms/clamp/1.cc: Fix order of arguments and + expected results when using predicate defining reverse order. + * testsuite/25_algorithms/clamp/constexpr.cc: Likewise. + 2017-09-20 Jonathan Wakely Backport from mainline diff --git a/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc b/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc index 991b10d1fe3..655c241e9a2 100644 --- a/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc +++ b/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc @@ -30,12 +30,12 @@ void test01() VERIFY( y == 3 ); VERIFY( z == 4 ); - const int xc = std::clamp(1, 2, 4, std::greater()); - const int yc = std::clamp(3, 2, 4, std::greater()); - const int zc = std::clamp(5, 2, 4, std::greater()); - VERIFY( xc == 4 ); - VERIFY( yc == 2 ); - VERIFY( zc == 2 ); + const int xc = std::clamp(1, 4, 2, std::greater()); + const int yc = std::clamp(3, 4, 2, std::greater()); + const int zc = std::clamp(5, 4, 2, std::greater()); + VERIFY( xc == 2 ); + VERIFY( yc == 3 ); + VERIFY( zc == 4 ); } int diff --git a/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc b/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc index 0864b8e1d30..606748ec689 100644 --- a/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc +++ b/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc @@ -27,5 +27,5 @@ # error "Feature-test macro for clamp has wrong value" #endif -static_assert(std::clamp(2, 0, 1) == 1, ""); -static_assert(std::clamp(2, 0, 1, std::greater()) == 0, ""); +static_assert(std::clamp(2, 0, 1) == 1); +static_assert(std::clamp(2, 1, 0, std::greater()) == 1);