<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/67338>67338</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`<ranges>`: range adaptor object unconditionally requires bound arguments to be move-constructible
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hewillk
</td>
</tr>
</table>
<pre>
Although the following is extremely contrived, sorry, it seems that it should be well-formed according to the current wording:
https://godbolt.org/z/EE647jeYn
```cpp
#include <ranges>
struct OnlyCopyable {
OnlyCopyable() = default;
OnlyCopyable(const OnlyCopyable&) = default;
OnlyCopyable(OnlyCopyable&&) = delete;
constexpr operator int() const { return 2; }
};
int main() {
constexpr OnlyCopyable arg;
// hard error in libc++ as std::bind_back constraint arguments to be move-constructible
constexpr auto closure = std::views::take(arg);
static_assert(std::string_view("ab") == closure(std::string_view("abcde")));
}
```
The issue here is that libc++ uses `std::__bind_back` to implement the `adaptor(args...)`, which is a constrained function that additionally requires `(is_move_constructible_v<std::decay_t<Args>> && ...)` compared to the wording in `<ranges>`.
It is worth noting that there is no isse with `adaptor | adaptor` as `std::__compose` is not a constraint function.
Not sure if this is worth filing an LWG.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVV2P6jYQ_TXmZbTIOJDAQx4WWKpKVftSqeoTcuwh8V3HpvZ4ufTXV0743L1Sr4SCPzJzjs-ccWSMpnWINVus2WI7kYk6H-oOT8ba90nj9bl-tdT51HZAHcLBW-tPxrVgIuB3CtijPYPyjoL5QM3EBqIP4ZwHhiAi9hGokzTMOp-shgbhhNa-HHzoUYNUygedc5IfQFQKAR3BaVxmxSvjW8Yvz47oGPOa2DGxa71uvKWpDy0Tu3-Z2L29lfPqG_7tHoNYycefOh4vK6IwTtmkEVixCdK1GFnx9hgUKSRF8Iez540_nmVjEVi1HjfhaZ2JJRMrYMUWNB5k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