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

            Bug ID: 95910
           Summary: transform view in combination with single view calls
                    const qualified begin even if it is not const
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rene.r...@fu-berlin.de
  Target Milestone: ---

Hi gcc team,

I am wondering why the following code results in an static assert:
```cpp
#include <concepts>
#include <ranges>
#include <vector>

auto transform_v = [] (auto && v)
{
    static_assert(std::same_as<decltype(v), int &>);
    return v;
};

using range_t = decltype(std::views::single(0));  // falsely calls const
qualified begin somewhere in stack
// using range_t = std::vector<int>; // OK, everyting as expected.
using transformed_view_t = decltype(std::declval<range_t &>() |
std::views::transform(transform_v));
using ref_t = std::ranges::range_reference_t<transformed_view_t>;
```

Here is the example on https://godbolt.org/z/QWvYue.

It seems, that somewhere in the stack the transform view is promoted to a const
view even though it should not, shouldn't it?

Sorry, if I got something wrong.

Reply via email to