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

            Bug ID: 116549
           Summary: std::disable_sized_sentinel_for is missing
                    specialisation for std::move_iterator
           Product: gcc
           Version: 14.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daidodo at gmail dot com
  Target Milestone: ---

Hi, the following code fail to compile:

```
// std=c++23

#include <iterator>

int main() {
    static_assert(not std::sized_sentinel_for<int*, int**>);
    using S = std::move_iterator<int*>;
    using I = std::move_iterator<int**>;
    static_assert(true == std::disable_sized_sentinel_for<S, I>); // error
}
```

When S is not a sized sentinel of I, we should not make std::move_iterator<S> a
sized sentinel for std::move_iterator<I>.

According to cppreference
(https://en.cppreference.com/w/cpp/iterator/move_iterator), there should be a
specialisation of std::disable_sized_sentinel_for:

```
template< class Iterator1, class Iterator2 >
    requires (!std::sized_sentinel_for<Iterator1, Iterator2>)
constexpr bool disable_sized_sentinel_for<
    std::move_iterator<Iterator1>,
    std::move_iterator<Iterator2>> = true;
```

But I couldn't find it in any of the current GCC source, especially
*libstdc++-v3/include/bits/stl_iterator.h* where std::move_iterator is defined.

Please confirm if it's a miss?

Thanks,
Zhao

Reply via email to