Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.8.0
-
None
-
-
b8c879f27 (dev), 6535b6d5f (6.8)
-
Foundation Sprint 118
Description
The following code fails to compile (at least on GCC 9.4 and in C++20 mode):
QList<int> l; assert(std::to_address(l.begin()) == l.data());
GCC says
/usr/include/c++/9/bits/ptr_traits.h: In instantiation of ‘struct std::pointer_traits<QList<int>::iterator>’: /usr/include/c++/9/bits/ptr_traits.h:171:54: required by substitution of ‘template<class _Ptr> constexpr decltype (std::pointer_traits<_Ptr>::to_address(__ptr)) std::__to_address(const _Ptr&) [with _Ptr = QList<int>::iterator]’ /usr/include/c++/9/bits/ptr_traits.h:207:31: required from ‘constexpr auto std::to_address(const _Ptr&) [with _Ptr = QList<int>::iterator]’ /usr/include/c++/9/bits/ptr_traits.h:119:21: error: static assertion failed: pointer type defines element_type or is like SomePointer<T, Args> 119 | static_assert(!is_same<element_type, __undefined>::value, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It works for l.rbegin(), though.
Attachments
For Gerrit Dashboard: QTBUG-130643 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
600459,4 | Remove LWG3346 (really 3446¹) GCC work-around | dev | qt/qtbase | Status: NEW | +2 | +1 |