Skip to content
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

<ranges>: ranges::equal does not work for ranges with integer-class range_difference_t #3550

Closed
JMazurkiewicz opened this issue Mar 8, 2023 · 1 comment · Fixed by #3551
Labels
bug Something isn't working fixed Something works now, yay! ranges C++20/23 ranges

Comments

@JMazurkiewicz
Copy link
Contributor

JMazurkiewicz commented Mar 8, 2023

Repro:

#include <algorithm>
#include <ranges>

using namespace std;

void f() {
  auto v = views::iota(0ull, 5ull) | views::stride(2); // range_difference_t<v> == _Unsigned128
  auto w = views::iota(0ull, 5ull) | views::stride(2);
  (void)ranges::equal(v, w);
}

Expected: correct compilation
Got: error (see link below)
Compiler explorer: https://godbolt.org/z/crcbMfY7z
Discovered while implementing #2923

@StephanTLavavej StephanTLavavej added bug Something isn't working ranges C++20/23 ranges labels Mar 8, 2023
@StephanTLavavej
Copy link
Member

Yep, this seems like a bug in _Equal_count, with a very simple fix. A brief search indicated no other occurrences of integral _Size so hopefully this is the only one.

JMazurkiewicz added a commit to JMazurkiewicz/STL that referenced this issue Mar 9, 2023
@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label Mar 13, 2023
JMazurkiewicz added a commit to JMazurkiewicz/STL that referenced this issue Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Something works now, yay! ranges C++20/23 ranges
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants