Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.5
-
None
-
8a11f16dc0 (qt/qtbase/dev) 8a11f16dc0 (qt/tqtc-qtbase/dev)
Description
An attempt to compile Qt with GCC 13 fails, and the compiler complains about
template <typename Container, if_convertible_to<QString, Container> = true>
constexpr QAnyStringView(Container &&c, QtPrivate::wrapped_t<Container, QString> &&capacity = {})
saying, this:
/usr/local/include/c++/13.0.0/type_traits:1417:30: error: invalid use of incomplete type ‘class QString’ 1417 | : public __bool_constant<__is_convertible(_From, _To)>
The compiler is correct. qstring.h includes qanystringview.h, and there we then have a constraint that's querying for convertibility from Container to QString. That cannot work, because it goes down to is_convertible, which in turn requires complete types. And of course it requires complete types, convertibility depends on constructors and conversion operators. QString isn't complete at this point, we haven't defined it yet, we just came here via an include that occurs before the definition of QString.
In GCC 13, is_convertible uses __is_convertible, which is able to diagnose incomplete types.