QList::(const_)iterator: protect element_type on GCC < 11
GCC 10 in C++20 mode will still try to use std::indirectly_readable_traits on QList iterators, and since it does not have the fixes for LWG 3346 / 3541, it will fail to build: /usr/include/c++/10/bits/iterator_concepts.h: In substitution of ‘template<class _Tp> using __iter_value_t = typename std::__detail::__iter_traits_impl<_Tp, std::indirectly_readable_traits<_Iter> >::type::value_type [with _Tp = QList<std::pair<int, int> >::const_iterator]’: /usr/include/c++/10/bits/iterator_concepts.h:248:11: required by substitution of ‘template<class _Tp> using iter_value_t = std::__detail::__iter_value_t<typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type> [with _Tp = QList<std::pair<int, int> >::const_iterator]’ /usr/include/c++/10/bits/iterator_concepts.h:468:11: required from ‘class std::reverse_iterator<QList<std::pair<int, int> >::const_iterator>’ ../src/corelib/itemmodels/qsortfilterproxymodel.cpp:669:43: required from here /usr/include/c++/10/bits/iterator_concepts.h:243:13: error: ambiguous template instantiation for ‘struct std::indirectly_readable_traits<QList<std::pair<int, int> >::const_iterator>’ 243 | using __iter_value_t = typename | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/iterator_concepts.h:231:12: note: candidates are: ‘template<class _Tp> requires requires{typename _Tp::value_type;} struct std::indirectly_readable_traits<_Iter> [with _Tp = QList<std::pair<int, int> >::const_iterator]’ 231 | struct indirectly_readable_traits<_Tp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/iterator_concepts.h:236:12: note: ‘template<class _Tp> requires requires{typename _Tp::element_type;} struct std::indirectly_readable_traits<_Iter> [with _Tp = QList<std::pair<int, int> >::const_iterator]’ 236 | struct indirectly_readable_traits<_Tp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ So hide element_type as well. The CI didn't catch this because the CI doesn't build in C++20 mode. Amends 595b4e1a9b4. Change-Id: I5c8e47d693ca584571cd89f856d08ba249dd05ab Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
b322bfcc14
commit
5656a60dd0
@ -137,10 +137,10 @@ public:
|
||||
// libstdc++ shipped with gcc < 11 does not have a fix for defect LWG 3346
|
||||
#if __cplusplus >= 202002L && (!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE >= 11)
|
||||
using iterator_category = std::contiguous_iterator_tag;
|
||||
using element_type = value_type;
|
||||
#else
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
#endif
|
||||
using element_type = value_type;
|
||||
|
||||
using pointer = T *;
|
||||
using reference = T &;
|
||||
@ -179,10 +179,10 @@ public:
|
||||
// libstdc++ shipped with gcc < 11 does not have a fix for defect LWG 3346
|
||||
#if __cplusplus >= 202002L && (!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE >= 11)
|
||||
using iterator_category = std::contiguous_iterator_tag;
|
||||
using element_type = const value_type;
|
||||
#else
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
#endif
|
||||
using element_type = const value_type;
|
||||
using pointer = const T *;
|
||||
using reference = const T &;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user