https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101231

            Bug ID: 101231
           Summary: _CachedPosition::_M_get() should not return {} when
                    range adapter does not model forward_range
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

After P2325, iterators such as basic_istream_view::iterator are no longer
default_initializable, so _CachedPosition::_M_get() should not just return {}
when the adapter does not model forward_range.

#include <ranges>
#include <sstream>

int main() {
  auto words = std::istringstream{"42"};
  auto is = std::ranges::istream_view<int>(words);
  auto r = is | std::views::filter([](auto) { return true; });
  for (auto x : r);
}


https://godbolt.org/z/PejdYzc8j

Reply via email to