Skip to content

[libc++] Remove redundant and somewhat confusing assertions around advance() #133276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Adjust error messages
  • Loading branch information
ldionne committed Apr 3, 2025
commit 6e6af4fa7051f6431e314696190c9131adf962c5
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/iterators/assert.next.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(int, char**) {
forward_iterator<int *> it(a+1);
(void)std::next(it, 1); // should work fine
(void)std::next(it, 0); // should work fine
TEST_LIBCPP_ASSERT_FAILURE(std::next(it, -1), "Attempt to next(it, n) with negative n on a non-bidirectional iterator");
TEST_LIBCPP_ASSERT_FAILURE(std::next(it, -1), "Attempt to advance(it, n) with negative n on a non-bidirectional iterator");

return 0;
}
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/iterators/assert.prev.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main(int, char**) {
forward_iterator<int *> it(a+1);
(void)std::prev(it, -1); // should work fine
(void)std::prev(it, 0); // should work fine
TEST_LIBCPP_ASSERT_FAILURE(std::prev(it, 1), "Attempt to prev(it, n) with a positive n on a non-bidirectional iterator");
TEST_LIBCPP_ASSERT_FAILURE(std::prev(it, 1), "Attempt to advance(it, n) with negative n on a non-bidirectional iterator");

return 0;
}
Loading