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

            Bug ID: 103831
           Summary: views::lazy_split accepts Pattern as span<int, 1> when
                    V is input_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: ---

This is an extremely strange case that I suspect is a language bug, consider:

  #include <ranges>
  #include <array>
  #include <stream>
  #include <span>
  int main() {
    auto ints = std::istringstream{"42"};
    auto r = std::ranges::istream_view<int>(ints);
    std::array<int, 1> arr{42};
    std::span p{arr};
    std::ranges::lazy_split_view s(r, p);
  }

https://godbolt.org/z/o9EY9oPx6

In the above example, lazy_split_view should be rejected.
According to [range.lazy.split.view], when V does not model forward_range,
Pattern must be a tiny_range, however, span<int, 1> does not model tiny_range
since it does not have a static size function, so lazy_split_view should be
ill-formed. 
I really don’t know why it will still be accepted.

Reply via email to