Re: [PATCH] D22584: constexpr array support C++1z (P0031)
lefticus updated this revision to Diff 71668. lefticus added a comment. Add C++1z check around constexpr tests, based on mclow's feedback https://reviews.llvm.org/D22584 Files: include/array include/iterator test/std/containers/sequences/array/at.pass.cpp test/std/containers/sequences/array/begin.pass.cpp test/std/containers/sequences/array/front_back.pass.cpp test/std/containers/sequences/array/indexing.pass.cpp test/std/containers/sequences/array/iterators.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp Index: test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp @@ -33,12 +33,23 @@ int main() { -const char* s = "1234567890"; -test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); -test(random_access_iterator(s+10), 10, random_access_iterator(s)); -test(s+10, 10, s); - -test(bidirectional_iterator(s+1), bidirectional_iterator(s)); -test(random_access_iterator(s+1), random_access_iterator(s)); -test(s+1, s); +{ +const char* s = "1234567890"; +test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); +test(random_access_iterator(s+10), 10, random_access_iterator(s)); +test(s+10, 10, s); + +test(bidirectional_iterator(s+1), bidirectional_iterator(s)); +test(random_access_iterator(s+1), random_access_iterator(s)); +test(s+1, s); +} + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::prev(s+10, 10) == s); +static_assert(std::prev(s+1) == s); +} +#endif + } Index: test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp @@ -35,16 +35,27 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), 10, input_iterator(s+10)); -test(forward_iterator(s), 10, forward_iterator(s+10)); -test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); -test(random_access_iterator(s), 10, random_access_iterator(s+10)); -test(s, 10, s+10); - -test(input_iterator(s), input_iterator(s+1)); -test(forward_iterator(s), forward_iterator(s+1)); -test(bidirectional_iterator(s), bidirectional_iterator(s+1)); -test(random_access_iterator(s), random_access_iterator(s+1)); -test(s, s+1); +{ +const char* s = "1234567890"; +test(input_iterator(s), 10, input_iterator(s+10)); +test(forward_iterator(s), 10, forward_iterator(s+10)); +test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); +test(random_access_iterator(s), 10, random_access_iterator(s+10)); +test(s, 10, s+10); + +test(input_iterator(s), input_iterator(s+1)); +test(forward_iterator(s), forward_iterator(s+1)); +test(bidirectional_iterator(s), bidirectional_iterator(s+1)); +test(random_access_iterator(s), random_access_iterator(s+1)); +test(s, s+1); +} + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::next(s, 10) == s+10); +static_assert(std::next(s) == s+1); +} +#endif + } Index: test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp @@ -31,10 +31,21 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), input_iterator(s+10), 10); -test(forward_iterator(s), forward_iterator(s+10), 10); -test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); -test(random_access_iterator(s), random_access_iterator(s+10), 10); -test(s, s+10, 10); +{ +const char* s = "1234567890"; +test(input_iterator(s), input_iterator(s+10), 10); +test(forward_iterator(s), forward_iterator(s+10), 10); +test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); +test(random_access_iterator(s), random_access_iterator(s+10), 10); +test(s, s+10, 10); +} + + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::distance(s, s+10)
Re: [PATCH] D22584: constexpr array support C++1z (P0031)
lefticus updated this revision to Diff 69195. lefticus added a comment. Address formatting concerns and out-of-date-ness of patch relative to trunk/master https://reviews.llvm.org/D22584 Files: include/array include/iterator test/std/containers/sequences/array/at.pass.cpp test/std/containers/sequences/array/begin.pass.cpp test/std/containers/sequences/array/front_back.pass.cpp test/std/containers/sequences/array/indexing.pass.cpp test/std/containers/sequences/array/iterators.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp Index: test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp @@ -33,12 +33,21 @@ int main() { -const char* s = "1234567890"; -test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); -test(random_access_iterator(s+10), 10, random_access_iterator(s)); -test(s+10, 10, s); - -test(bidirectional_iterator(s+1), bidirectional_iterator(s)); -test(random_access_iterator(s+1), random_access_iterator(s)); -test(s+1, s); +{ +const char* s = "1234567890"; +test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); +test(random_access_iterator(s+10), 10, random_access_iterator(s)); +test(s+10, 10, s); + +test(bidirectional_iterator(s+1), bidirectional_iterator(s)); +test(random_access_iterator(s+1), random_access_iterator(s)); +test(s+1, s); +} + +{ +constexpr const char* s = "1234567890"; +static_assert(std::prev(s+10, 10) == s); +static_assert(std::prev(s+1) == s); +} + } Index: test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp @@ -35,16 +35,27 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), 10, input_iterator(s+10)); -test(forward_iterator(s), 10, forward_iterator(s+10)); -test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); -test(random_access_iterator(s), 10, random_access_iterator(s+10)); -test(s, 10, s+10); - -test(input_iterator(s), input_iterator(s+1)); -test(forward_iterator(s), forward_iterator(s+1)); -test(bidirectional_iterator(s), bidirectional_iterator(s+1)); -test(random_access_iterator(s), random_access_iterator(s+1)); -test(s, s+1); +{ +const char* s = "1234567890"; +test(input_iterator(s), 10, input_iterator(s+10)); +test(forward_iterator(s), 10, forward_iterator(s+10)); +test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); +test(random_access_iterator(s), 10, random_access_iterator(s+10)); +test(s, 10, s+10); + +test(input_iterator(s), input_iterator(s+1)); +test(forward_iterator(s), forward_iterator(s+1)); +test(bidirectional_iterator(s), bidirectional_iterator(s+1)); +test(random_access_iterator(s), random_access_iterator(s+1)); +test(s, s+1); +} + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::next(s, 10) == s+10); +static_assert(std::next(s) == s+1); +} +#endif + } Index: test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp @@ -31,10 +31,21 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), input_iterator(s+10), 10); -test(forward_iterator(s), forward_iterator(s+10), 10); -test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); -test(random_access_iterator(s), random_access_iterator(s+10), 10); -test(s, s+10, 10); +{ +const char* s = "1234567890"; +test(input_iterator(s), input_iterator(s+10), 10); +test(forward_iterator(s), forward_iterator(s+10), 10); +test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); +test(random_access_iterator(s), random_access_iterator(s+10), 10); +test(s, s+10, 10); +} + + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::distance(s, s+10) == 10); +
Re: [PATCH] D22584: constexpr array support C++1z (P0031)
lefticus added a comment. I believe all or most of the "untested" comments are correctly tested in the updated test files via static_asserts with contexpr. I've commented on just the first one to make sure I understand correctly. Comment at: include/array:156 @@ -155,3 +155,3 @@ _LIBCPP_INLINE_VISIBILITY -iterator begin() _NOEXCEPT {return iterator(__elems_);} +_LIBCPP_CONSTEXPR_AFTER_CXX14 iterator begin() _NOEXCEPT {return iterator(__elems_);} _LIBCPP_INLINE_VISIBILITY This should be tested in begin.pass.cpp:28 correct? https://reviews.llvm.org/D22584 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22584: constexpr array support C++1z (P0031)
lefticus updated this revision to Diff 65398. lefticus added a comment. Correct context from last patch https://reviews.llvm.org/D22584 Files: include/array include/iterator test/std/containers/sequences/array/at.pass.cpp test/std/containers/sequences/array/begin.pass.cpp test/std/containers/sequences/array/front_back.pass.cpp test/std/containers/sequences/array/indexing.pass.cpp test/std/containers/sequences/array/iterators.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp Index: test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp @@ -33,12 +33,21 @@ int main() { -const char* s = "1234567890"; -test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); -test(random_access_iterator(s+10), 10, random_access_iterator(s)); -test(s+10, 10, s); - -test(bidirectional_iterator(s+1), bidirectional_iterator(s)); -test(random_access_iterator(s+1), random_access_iterator(s)); -test(s+1, s); +{ +const char* s = "1234567890"; +test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); +test(random_access_iterator(s+10), 10, random_access_iterator(s)); +test(s+10, 10, s); + +test(bidirectional_iterator(s+1), bidirectional_iterator(s)); +test(random_access_iterator(s+1), random_access_iterator(s)); +test(s+1, s); +} + +{ +constexpr const char* s = "1234567890"; +static_assert(std::prev(s+10, 10) == s); +static_assert(std::prev(s+1) == s); +} + } Index: test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp @@ -35,16 +35,27 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), 10, input_iterator(s+10)); -test(forward_iterator(s), 10, forward_iterator(s+10)); -test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); -test(random_access_iterator(s), 10, random_access_iterator(s+10)); -test(s, 10, s+10); - -test(input_iterator(s), input_iterator(s+1)); -test(forward_iterator(s), forward_iterator(s+1)); -test(bidirectional_iterator(s), bidirectional_iterator(s+1)); -test(random_access_iterator(s), random_access_iterator(s+1)); -test(s, s+1); +{ +const char* s = "1234567890"; +test(input_iterator(s), 10, input_iterator(s+10)); +test(forward_iterator(s), 10, forward_iterator(s+10)); +test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); +test(random_access_iterator(s), 10, random_access_iterator(s+10)); +test(s, 10, s+10); + +test(input_iterator(s), input_iterator(s+1)); +test(forward_iterator(s), forward_iterator(s+1)); +test(bidirectional_iterator(s), bidirectional_iterator(s+1)); +test(random_access_iterator(s), random_access_iterator(s+1)); +test(s, s+1); +} + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::next(s, 10) == s+10); +static_assert(std::next(s) == s+1); +} +#endif + } Index: test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp @@ -31,10 +31,21 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), input_iterator(s+10), 10); -test(forward_iterator(s), forward_iterator(s+10), 10); -test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); -test(random_access_iterator(s), random_access_iterator(s+10), 10); -test(s, s+10, 10); +{ +const char* s = "1234567890"; +test(input_iterator(s), input_iterator(s+10), 10); +test(forward_iterator(s), forward_iterator(s+10), 10); +test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); +test(random_access_iterator(s), random_access_iterator(s+10), 10); +test(s, s+10, 10); +} + + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::distance(s, s+10) == 10); +} +#endif + } Index: test/std/iterators/iterator.p
Re: [PATCH] D22584: constexpr array support C++1z (P0031)
lefticus added a comment. I believe I messed up the context for the files, will attempt to resubmit the patch. https://reviews.llvm.org/D22584 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22584: constexpr array support C++1z (P0031)
lefticus marked 3 inline comments as done. lefticus added a comment. https://reviews.llvm.org/D22584 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22584: constexpr array support C++1z (P0031)
lefticus updated this revision to Diff 65390. lefticus added a comment. Fixed syntax errors in test files. https://reviews.llvm.org/D22584 Files: include/array include/iterator test/std/containers/sequences/array/at.pass.cpp test/std/containers/sequences/array/begin.pass.cpp test/std/containers/sequences/array/front_back.pass.cpp test/std/containers/sequences/array/indexing.pass.cpp test/std/containers/sequences/array/iterators.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp Index: test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp @@ -33,12 +33,21 @@ int main() { -const char* s = "1234567890"; -test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); -test(random_access_iterator(s+10), 10, random_access_iterator(s)); -test(s+10, 10, s); - -test(bidirectional_iterator(s+1), bidirectional_iterator(s)); -test(random_access_iterator(s+1), random_access_iterator(s)); -test(s+1, s); +{ +const char* s = "1234567890"; +test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); +test(random_access_iterator(s+10), 10, random_access_iterator(s)); +test(s+10, 10, s); + +test(bidirectional_iterator(s+1), bidirectional_iterator(s)); +test(random_access_iterator(s+1), random_access_iterator(s)); +test(s+1, s); +} + +{ +constexpr const char* s = "1234567890"; +static_assert(std::prev(s+10, 10) == s); +static_assert(std::prev(s+1) == s); +} + } Index: test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp @@ -35,16 +35,27 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), 10, input_iterator(s+10)); -test(forward_iterator(s), 10, forward_iterator(s+10)); -test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); -test(random_access_iterator(s), 10, random_access_iterator(s+10)); -test(s, 10, s+10); - -test(input_iterator(s), input_iterator(s+1)); -test(forward_iterator(s), forward_iterator(s+1)); -test(bidirectional_iterator(s), bidirectional_iterator(s+1)); -test(random_access_iterator(s), random_access_iterator(s+1)); -test(s, s+1); +{ +const char* s = "1234567890"; +test(input_iterator(s), 10, input_iterator(s+10)); +test(forward_iterator(s), 10, forward_iterator(s+10)); +test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); +test(random_access_iterator(s), 10, random_access_iterator(s+10)); +test(s, 10, s+10); + +test(input_iterator(s), input_iterator(s+1)); +test(forward_iterator(s), forward_iterator(s+1)); +test(bidirectional_iterator(s), bidirectional_iterator(s+1)); +test(random_access_iterator(s), random_access_iterator(s+1)); +test(s, s+1); +} + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::next(s, 10) == s+10); +static_assert(std::next(s) == s+1); +} +#endif + } Index: test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp @@ -31,10 +31,21 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), input_iterator(s+10), 10); -test(forward_iterator(s), forward_iterator(s+10), 10); -test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); -test(random_access_iterator(s), random_access_iterator(s+10), 10); -test(s, s+10, 10); +{ +const char* s = "1234567890"; +test(input_iterator(s), input_iterator(s+10), 10); +test(forward_iterator(s), forward_iterator(s+10), 10); +test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); +test(random_access_iterator(s), random_access_iterator(s+10), 10); +test(s, s+10, 10); +} + + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::distance(s, s+10) == 10); +} +#endif + } Index: test/std/iterators/iterato
Re: [PATCH] D22584: constexpr array support C++1z (P0031)
lefticus retitled this revision from "C++1z constexpr support for array and iterator" to "constexpr array support C++1z (P0031)". lefticus updated the summary for this revision. lefticus updated this revision to Diff 65143. lefticus added a comment. - Updated title and summary to be more accurate. - Implemented tests for constexpr std::array access. - Added required constexpr iterator support. - Implemented tests for constexpr iterator functions https://reviews.llvm.org/D22584 Files: include/array include/iterator test/std/containers/sequences/array/at.pass.cpp test/std/containers/sequences/array/begin.pass.cpp test/std/containers/sequences/array/front_back.pass.cpp test/std/containers/sequences/array/indexing.pass.cpp test/std/containers/sequences/array/iterators.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp Index: test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp @@ -33,12 +33,21 @@ int main() { -const char* s = "1234567890"; -test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); -test(random_access_iterator(s+10), 10, random_access_iterator(s)); -test(s+10, 10, s); - -test(bidirectional_iterator(s+1), bidirectional_iterator(s)); -test(random_access_iterator(s+1), random_access_iterator(s)); -test(s+1, s); +{ +const char* s = "1234567890"; +test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); +test(random_access_iterator(s+10), 10, random_access_iterator(s)); +test(s+10, 10, s); + +test(bidirectional_iterator(s+1), bidirectional_iterator(s)); +test(random_access_iterator(s+1), random_access_iterator(s)); +test(s+1, s); +} + +{ +constexpr const char* s = "1234567890"; +static_assert(std::prev(s+10, 10) == s); +static_assert(std::prev(s+1) == s); +} + } Index: test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp @@ -35,16 +35,27 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), 10, input_iterator(s+10)); -test(forward_iterator(s), 10, forward_iterator(s+10)); -test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); -test(random_access_iterator(s), 10, random_access_iterator(s+10)); -test(s, 10, s+10); - -test(input_iterator(s), input_iterator(s+1)); -test(forward_iterator(s), forward_iterator(s+1)); -test(bidirectional_iterator(s), bidirectional_iterator(s+1)); -test(random_access_iterator(s), random_access_iterator(s+1)); -test(s, s+1); +{ +const char* s = "1234567890"; +test(input_iterator(s), 10, input_iterator(s+10)); +test(forward_iterator(s), 10, forward_iterator(s+10)); +test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); +test(random_access_iterator(s), 10, random_access_iterator(s+10)); +test(s, 10, s+10); + +test(input_iterator(s), input_iterator(s+1)); +test(forward_iterator(s), forward_iterator(s+1)); +test(bidirectional_iterator(s), bidirectional_iterator(s+1)); +test(random_access_iterator(s), random_access_iterator(s+1)); +test(s, s+1); +} + +#if TEST_STD_VER > 14 +{ +constexpr const char* s = "1234567890"; +static_assert(std::next(s, 10) == s+10); +static_assert(std::next(s) == s+1); +} +#endif + } Index: test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp === --- test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp +++ test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp @@ -31,10 +31,21 @@ int main() { -const char* s = "1234567890"; -test(input_iterator(s), input_iterator(s+10), 10); -test(forward_iterator(s), forward_iterator(s+10), 10); -test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); -test(random_access_iterator(s), random_access_iterator(s+10), 10); -test(s, s+10, 10); +{ +const char* s = "1234567890"; +test(input_iterator(s), input_iterator(s+10), 10); +test(forward_iterator(s), forward_iterator(s+10), 10); +test(bidirectional_itera