https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116549
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Zhao Dai from comment #0) > 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>. We don't make it a sized sentinel though: #include <iterator> using S = std::move_iterator<int*>; using I = std::move_iterator<int**>; static_assert(not std::sized_sentinel_for<S, I>); static_assert(not std::sized_sentinel_for<I, S>); The way to tell if something is a sized sentinel is to test std::sized_sentinel_for. Testing std::disable_sized_sentinel_for is wrong. You cannot rely on that to tell you if something is a sized sentinel. In the example above, std::sentinel_for<S, I> is false, so std::disable_sized_sentinel_for is never needed. The resolution to LWG issue 3736 says we should add that specialization anyway, but I think it's redundant and not observable by any sensible code that uses std::sized_sentinel_for correctly. (This was noted in the issue discussion.) I'll add the disable_sized_sentinel_for specialization, because the standard says we should define it. But your example code is not something that anybody should ever write in real code. > > 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