[Bug c++/95578] New: std::ranges::copy and std::views::take_while don't want to play together

gcc-bugs at marehr dot dialup.fu-berlin.de gcc-bugzilla@gcc.gnu.org
Mon Jun 8 15:11:24 GMT 2020


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

            Bug ID: 95578
           Summary: std::ranges::copy and std::views::take_while don't
                    want to play together
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de
  Target Milestone: ---

Hi gcc-team,

the following code does not compile (10.1.0 and trunk)

```c++
#include <ranges>
#include <algorithm>

int main()
{
    std::vector<int> v{};
    // auto && rng = v; // does work
    auto && rng = v | std::views::take_while([](auto &&){return true;}); //
does not work

    std::vector<int> rng_copy{};
    std::ranges::copy(rng, std::back_inserter(rng_copy));
    return 0;
}
```
https://godbolt.org/z/nmRQgo


More information about the Gcc-bugs mailing list