diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-02-07 16:46:42 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-02-07 16:54:54 +0000 |
commit | d222d8ec3c100f5c0a6974e7dcee16903f6f0e3a (patch) | |
tree | 8d9d748edb42fa3e99f5548cdebfc34fbbbc5b6a | |
parent | 6fa476f6e1a07cf7fafec256ae52cdcb948b133d (diff) | |
download | gcc-d222d8ec3c100f5c0a6974e7dcee16903f6f0e3a.zip gcc-d222d8ec3c100f5c0a6974e7dcee16903f6f0e3a.tar.gz gcc-d222d8ec3c100f5c0a6974e7dcee16903f6f0e3a.tar.bz2 |
libstdc++: Fix bug in iterator_traits<common_iterator<S,I>>
The wrong type was being used in the __common_iter_has_arrow constraint,
creating a circular dependency where the iterator_traits specialization
was needed before it was complete. The correct parameter for the
__common_iter_has_arrow concept is the first template argument of the
common_iterator, not the common_iterator itself.
* include/bits/stl_iterator.h (__detail::__common_iter_ptr): Change
to take parameters of common_iterator, instead of the common_iterator
type itself. Fix argument for __common_iter_has_arrow constraint.
(iterator_traits<common_iterator<I, S>>::pointer): Adjust.
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_iterator.h | 16 |
2 files changed, 16 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7c9a8a6..4d8ea9d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2020-02-07 Jonathan Wakely <jwakely@redhat.com> + * include/bits/stl_iterator.h (__detail::__common_iter_ptr): Change + to take parameters of common_iterator, instead of the common_iterator + type itself. Fix argument for __common_iter_has_arrow constraint. + (iterator_traits<common_iterator<I, S>>::pointer): Adjust. + +2020-02-07 Jonathan Wakely <jwakely@redhat.com> + * include/std/ranges (iota_view): Add braces to prevent -Wempty-body warning. (basic_istream_view::_Iterator::operator++()): Add missing return. diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 69c6ae6..4680465 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -1738,17 +1738,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __detail { // FIXME: This has to be at namespace-scope because of PR 92103. - template<typename _Iter> + template<typename _It, typename _Sent> struct __common_iter_ptr { using type = void; }; - template<typename _Iter> - requires __detail::__common_iter_has_arrow<_Iter> - struct __common_iter_ptr<_Iter> + template<typename _It, typename _Sent> + requires __detail::__common_iter_has_arrow<_It> + struct __common_iter_ptr<_It, _Sent> { - using type = decltype(std::declval<const _Iter&>().operator->()); + using common_iterator = std::common_iterator<_It, _Sent>; + + using type + = decltype(std::declval<const common_iterator&>().operator->()); }; } // namespace __detail @@ -1762,8 +1765,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION forward_iterator_tag, input_iterator_tag>; using value_type = iter_value_t<_It>; using difference_type = iter_difference_t<_It>; - using pointer = typename - __detail::__common_iter_ptr<common_iterator<_It, _Sent>>::type; + using pointer = typename __detail::__common_iter_ptr<_It, _Sent>::type; using reference = iter_reference_t<_It>; }; |