diff --git a/libcxx/include/iterator b/libcxx/include/iterator --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -767,16 +767,25 @@ template class _LIBCPP_TEMPLATE_VIS back_insert_iterator +#if _LIBCPP_STD_VER <= 17 : public iterator +#endif // _LIBCPP_STD_VER <= 17 { protected: _Container* container; public: typedef _Container container_type; +#if _LIBCPP_STD_VER > 17 + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef ptrdiff_t difference_type; + typedef void pointer; + typedef void reference; +#endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator& operator=(const typename _Container::value_type& __value_) @@ -800,16 +809,25 @@ template class _LIBCPP_TEMPLATE_VIS front_insert_iterator +#if _LIBCPP_STD_VER <= 17 : public iterator +#endif // _LIBCPP_STD_VER <= 17 { protected: _Container* container; public: typedef _Container container_type; +#if _LIBCPP_STD_VER > 17 + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef ptrdiff_t difference_type; + typedef void pointer; + typedef void reference; +#endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator& operator=(const typename _Container::value_type& __value_) @@ -833,17 +851,26 @@ template class _LIBCPP_TEMPLATE_VIS insert_iterator +#if _LIBCPP_STD_VER <= 17 : public iterator +#endif // _LIBCPP_STD_VER <= 17 { protected: _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; +#if _LIBCPP_STD_VER > 17 + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef ptrdiff_t difference_type; + typedef void pointer; + typedef void reference; +#endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator(_Container& __x, typename _Container::iterator __i) : container(_VSTD::addressof(__x)), iter(__i) {} diff --git a/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp b/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp --- a/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp +++ b/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp @@ -173,10 +173,10 @@ static_assert( testStdlibIterator::iterator>, int, std::random_access_iterator_tag>()); static_assert( - testStdlibIterator::iterator>, void, std::output_iterator_tag>()); + testStdlibIterator::iterator>, void, std::output_iterator_tag, std::ptrdiff_t>()); static_assert( - testStdlibIterator::iterator>, void, std::output_iterator_tag>()); -static_assert(testStdlibIterator >, void, std::output_iterator_tag>()); + testStdlibIterator::iterator>, void, std::output_iterator_tag, std::ptrdiff_t>()); +static_assert(testStdlibIterator >, void, std::output_iterator_tag, std::ptrdiff_t>()); static_assert(testStdlibIteratorConst, int, std::input_iterator_tag>()); #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp @@ -48,7 +48,7 @@ q.test(); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp @@ -49,7 +49,7 @@ q.test(); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp @@ -52,7 +52,7 @@ q.test(); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), "");