Skip to content

copy_if test seem to violate the precondition #139464

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

Open
AlexGuteniev opened this issue May 11, 2025 · 0 comments
Open

copy_if test seem to violate the precondition #139464

AlexGuteniev opened this issue May 11, 2025 · 0 comments
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. test-suite

Comments

@AlexGuteniev
Copy link
Contributor

[alg.copy]/16:

Preconditions: The ranges [first, last) and [result, result + (last - first)) do not overlap.

The following test do not have this precondition satisfied, as it doesn't even have [result, result + (last - first)) range:

std::array<S, 4> in = {{{4, 2}, {1, 3}, {3, 4}, {3, 5}}};
std::array<S, 2> out;
auto ret = std::ranges::copy_if(in.begin(), in.end(), out.begin(), [](int i) { return i == 3; }, &S::val);

The following tests seem to be also affected by similar issue:

  • std/algorithms/alg.modifying.operations/alg.remove/ranges_remove_copy.pass.cpp
  • std/algorithms/alg.modifying.operations/alg.unique/unique_copy.pass.cpp
  • std/algorithms/alg.modifying.operations/alg.unique/ranges_unique_copy.pass.cpp
@EugeneZelenko EugeneZelenko added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. test-suite and removed new issue labels May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. test-suite
Projects
None yet
Development

No branches or pull requests

3 participants