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

            Bug ID: 113154
           Summary: std::views::values not working with rvalue references
                    to ranges
           Product: gcc
           Version: 11.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ivan.lazaric.gcc at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/a3c4P9sY6

```
#include <ranges>
#include <map>

void fn(){
    std::map<int, int> m;
    m | std::views::values; // works
    std::map<int, int>{} | std::views::values; // does not work

}
```

not an issue in newer versions, checked 13.2 and it worked

came across this by wanting to do:
```
std::map<Keys, Values> produce_map();

std::cout << std::ranges::max(produce_map | std::views::values) << std::endl;
```

options used: -std=c++20 -O3

Reply via email to