Disallow operators that accept lvalue references where mutation is prohibited
Open
thrust
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 486
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 295
Description
We are [going to](https://github.com/NVIDIA/cccl/issues/908) make operators accepting lvalue references a compilation error in CUB. This change will propagate to Thrust for algorithms like `thrust::transform_reduce`. Other algorithms, however, wrap user operators into thrust ones that actually accept lvalue references to constant values:
```cpp
bool all_of(InputIterator first, InputIterator last, Predicate pred)
{
return thrust::find_if(exec, first, last, thrust::detail::not1(pred)) == last;
}
```
This makes the issue not detectable by CUB. We have to find such thrust wrappers and add according static asserts in them.
Contributor guide
Assessment
This issue has not been assessed yet.