[Interest] can't dump QStringList with qDebug()

Thiago Macieira thiago.macieira at intel.com
Wed Mar 8 07:11:13 CET 2023

On Tuesday, 7 March 2023 21:20:02 PST Hamish Moffatt via Interest wrote:
> I confirm that my test code compiles in 6.5.0-beta3.

And I can reproduce the error with GCC 13 if I check out the 6.4.2 headers.

GCC 13 says:

note: candidate: ‘template<class T> QDebugIfHasDebugStreamContainer<QList<T>, 
T> operator<<(QDebug, const QList<T>&)’

note:   template argument deduction/substitution failed

qdebug.h:217:53:   required by substitution of ‘template<class T> 
QDebugIfHasDebugStreamContainer<QList<T>, T> operator<<(QDebug, const 
QList<T>&) [with T = QString]’

type_traits:2594:11: error: no type named ‘type’ in ‘struct 
std::enable_if<false, QDebug>’

This is GCC speak for "condition evaluated to false"

By moving the constraint from the return type to a static_assert inside the 
function, I can prove that the ostream test fails:

qdebug.h:219:5: error: static assertion failed due to requirement 
'QTypeTraits::has_ostream_operator_v<QDebug, QString>'

But that test is:
std::void_t<decltype(detail::reference<Stream>() << 

and if I copy that expression to the function, it does compile.

Moreover, the changes to qdebug.h and qtypeinfo.h don't seem related.

So I have no clue *why* the check fails and *how* it was fixed.

This is template black magic. It works right now and I've spent enough time 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230307/78822d21/attachment.bin>

More information about the Interest mailing list