https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127141
--- Comment #1 from ivan <irvsrc at gmail dot com> ---
I missed out the includes in the example, apologies, here is the amended
version:
```
#include <assert.h>
#include <ranges>
#include <string_view>
auto constexpr inline data = std::string_view{"__a_"};
auto constexpr fn(auto first, auto last) -> bool { // templated so the example
is portable
// {'_', '_', 'a', '_'}
++first; // {'_', 'a', '_'} <---- removing this = no error
first = std::ranges::find(first, last, 'a'); // {'a', '_'}
++first; // {'_'} <---- removing this = no error
return first != last; // should always be true
}
auto main() -> int {
// 1)
auto constexpr r1 = fn(std::ranges::begin(data), std::ranges::end(data));
static_assert(r1); // ok
// 2)
auto r2 = fn(std::ranges::begin(data), std::ranges::end(data));
assert(r2); // error
// ____
// 3)
auto data_copy = data;
auto r3 = fn(std::ranges::begin(data_copy), std::ranges::end(data_copy));
assert(r3); // ok
}
```