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

--- Comment #6 from Younan Zhang <zyn7109 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #4)
> But the reason that it accepts the argument is that it's an lvalue.
> 
> You tested std::ranges::viewable_range<std::vector<std::string>> but you
> should have tested std::ranges::viewable_range<std::vector<std::string>&>.


(In reply to Jonathan Wakely from comment #5)
> An lvalue vector has always been a viewable range. 

Yes you're right. `foo(v)` will return 1 now:

```cpp
template <typename T>
int foo(T) requires std::ranges::viewable_range<T&> { return 1; }
int foo(auto) { return 0; }
```

I also tested `auto(v) | std::views::reverse` and GCC rejects with:

```
...required for the satisfaction of 'viewable_range<_Range>':
note: no operand of the disjunction is satisfied...
```


(In reply to Jonathan Wakely from comment #5)
> That's just because Clang is broken and doesn't work with any libstdc++ views:
https://github.com/llvm/llvm-project/issues/44178

looks subtle ;)

Thanks for your detailed answer~

Reply via email to