[libcxx-commits] [libcxx] [libc++][ranges] LWG4096: `views::iota(views::iota(0))` should be rejected (PR #152855)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Aug 9 09:46:49 PDT 2025
================
@@ -374,10 +375,11 @@ namespace views {
namespace __iota {
struct __fn {
template <class _Start>
+ requires(requires(_Start __s) { ranges::iota_view<decay_t<_Start>>(std::forward<_Start>(__s)); })
----------------
frederick-vs-ja wrote:
I think we should do choose one of the following approaches:
- exactly using `decltype(ranges::iota_view<decay_t<_Start>>(std::forward<_Start>(__start)))` to achieve expression-equivalency, or
- using `requires` and deduced return type (plain `auto` for this `operator()`).
In either case, we should use `noexcept(noexcept(ranges::iota_view<decay_t<_Start>>(std::forward<_Start>(__start))))` for consistency.
(However, it is currently always equivalent to `noexcept(false)`. No change requested for exception specification strengthening.)
https://github.com/llvm/llvm-project/pull/152855
More information about the libcxx-commits
mailing list