https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119135
            Bug ID: 119135
           Summary: Typo in as_const range adaptor
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

/ranges#L9351:

        else if constexpr (__detail::__is_ref_view<_Tp>
                           && constant_range<const element_type>)
          return ref_view(static_cast<const element_type&>
                          (std::forward<_Range>(__r).base()));

const element_type& is never a range unless _Tp is a nested range.

https://godbolt.org/z/EezGz43EK

#include <vector>
#include <ranges>

int main() {
  std::vector<std::vector<int>> v;
  auto r = std::views::all(v) | std::views::as_const;
}

Reply via email to