diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp --- a/libcxx/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp @@ -47,6 +47,13 @@ assert(input[4] == 4); assert(input[5] + input[6] == 5 + 9); } + + { + T input[] = {0, 1, 2, 3, 4, 5, 7, 6}; + std::nth_element(Iter(input), Iter(input + 6), Iter(input + 8)); + assert(input[6] == 6); + assert(input[7] == 7); + } return true; }