diff --git a/libcxx/include/iterator b/libcxx/include/iterator --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -1277,6 +1277,7 @@ typedef typename iterator_traits::value_type value_type; typedef typename iterator_traits::difference_type difference_type; typedef typename iterator_traits::pointer pointer; + typedef typename pointer_traits::element_type element_type; typedef typename iterator_traits::reference reference; typedef typename iterator_traits::iterator_category iterator_category; #if _LIBCPP_STD_VER > 17 diff --git a/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp b/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp --- a/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp +++ b/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp @@ -14,7 +14,10 @@ // template constexpr auto to_address(const Ptr& p) noexcept; #include + #include +#include + #include "test_macros.h" class P1 @@ -122,5 +125,9 @@ int main(int, char**) { test(); static_assert(test()); + + std::vector vec = {1, 2, 3}; + assert(std::to_address(vec.begin()) == vec.data()); + return 0; }