libstdc++: Specialize std::pointer_traits<__normal_iterator<I,C>>
authorJonathan Wakely <jwakely@redhat.com>
Tue, 28 Sep 2021 14:26:46 +0000 (15:26 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 28 Sep 2021 19:22:50 +0000 (20:22 +0100)
commit82626be2d633a9802a8b08727ef51c627e37fee5
tree42611665bfec6c2fee6ef6035b7ac92038171fd4
parentb12d6e79899fd27833c53ffc3c973538244f62e1
libstdc++: Specialize std::pointer_traits<__normal_iterator<I,C>>

This allows std::__to_address to be used with __normal_iterator in
C++11/14/17 modes. Without the partial specialization the deduced
pointer_traits::element_type is incorrect, and so the return type of
__to_address is wrong.

A similar partial specialization is probably needed for
__gnu_debug::_Safe_iterator.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (pointer_traits): Define partial
specialization for __normal_iterator.
* testsuite/24_iterators/normal_iterator/to_address.cc: New test.
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/testsuite/24_iterators/normal_iterator/to_address.cc [new file with mode: 0644]