https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119415
--- Comment #10 from 康桓瑋 <hewillk at gmail dot com> --- (In reply to Tomasz Kamiński from comment #9) > > Hum, meeting Cpp17LegacyIterator requirements does not mean it is a C++17 > > input iterator, only iterator_traits<It>::iterator_category represents its > > category, so __cpp17_input_iterator should not be used here. > > There are more things that insert(pos, it, it) could rely on from the old > iterator model, including the iterator being copyable (not only sentinel) or > *it++ being well-formed. Checking __cpp17_input_iterator establish that all > of above is true. > > And for that types of iterators iterator_traits<It>::iterator_category will > generated correctly. std::iterator_traits uses __cpp17_input_iterator to obtain the correct categories, so those characteristics are guaranteed. Use __cpp17_input_iterator can still produce hard errors in some edge cases.