-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
6.8.3
-
None
Since https://github.com/llvm/llvm-project/pull/154092, building QtDeclarative 6.8.3 with libc++ fails, with errors like these:
include/c++/v1/__algorithm/sift_down.h:49:46: error: type 'QTaggedIterator<QTaggedIterator<QSequentialIterator, void>, std::random_access_iterator_tag>' does not provide a subscript operator
49 | } else if ((_child + 1) < __len && __comp(_first[__child], __first[__child + 1])) {
The offending code is here: https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/qml/jsruntime/qv4sequenceobject.cpp?h=v6.8.3#n53
The libc++ developer noted:
> That looks to me like an issue with the iterator. If its iterator_category derives from random_access_iteratorit has to provide a subscript operator according to https://eel.is/c++draft/iterator.requirements#tab:randomaccessiterator. Given that make_heap requires a random access iterator that part is not even optional.
> std::sort also requires random access iterators, so I'm not quite sure why there is a QSequentialIterable::BidirectionalIterator. (I assume that's bidirectional only)
This issue did go away in 6.9, in https://code.qt.io/cgit/qt/qtdeclarative.git/commit/src/qml/jsruntime/qv4sequenceobject.cpp?h=v6.9.0&id=6537b2b23b22d8ac776d1d97f436bb6d9e8e20da (which entirely removed the offending std::sort lines).
However, for Qt 6.8, what's the right approach here to fix the use of std::sort with QSequentialIterable::RandomAccessIterator and QSequentialIterable::BidirectionalIterator here?