diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -2505,7 +2505,7 @@ // rotate_copy template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result) { @@ -4393,7 +4393,7 @@ } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) @@ -4403,7 +4403,7 @@ } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp @@ -18,21 +18,22 @@ #include "test_macros.h" #include "test_iterators.h" -// #if TEST_STD_VER > 17 -// TEST_CONSTEXPR bool test_constexpr() { -// int ia[] = {1, 3, 5, 2, 5, 6}; -// int ib[std::size(ia)] = {0}; -// -// const size_t N = 2; -// const auto middle = std::begin(ia) + N; -// auto it = std::rotate_copy(std::begin(ia), middle, std::end(ia), std::begin(ib)); -// -// return std::distance(std::begin(ib), it) == std::size(ia) -// && std::equal (std::begin(ia), middle, std::begin(ib) + std::size(ia) - N) -// && std::equal (middle, std::end(ia), std::begin(ib)) -// ; -// } -// #endif +#if TEST_STD_VER > 17 +TEST_CONSTEXPR bool test_constexpr() { + int ia[] = {1, 3, 5, 2, 5, 6}; + int ib[std::size(ia)] = {0}; + + const size_t N = 2; + const auto middle = std::begin(ia) + N; + auto it = + std::rotate_copy(std::begin(ia), middle, std::end(ia), std::begin(ib)); + + return std::distance(std::begin(ib), it) == std::size(ia) && + std::equal(std::begin(ia), middle, + std::begin(ib) + std::size(ia) - N) && + std::equal(middle, std::end(ia), std::begin(ib)); +} +#endif template void @@ -148,9 +149,9 @@ test >(); test(); -// #if TEST_STD_VER > 17 -// static_assert(test_constexpr()); -// #endif +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif - return 0; + return 0; }