On 8/3/23 04:15, Thiago Macieira wrote:
On Monday, 6 March 2023 22:15:01 PST Hamish Moffatt via Interest wrote:
../../../../Qt6.4.2/6.4.2/gcc_64/include/QtCore/qdebug.h:217:53: note:
candidate template ignored: requirement
'std::conjunction_v<std::disjunction<std::is_base_of<QList<QString>,
QString>, QTypeTraits::has_ostream_operator<QDebug, QString, void>>>' was
not satisfied [with T = QString]
This is the expected template and the compiler told us why it couldn't expand:
it thinks that the QDebugIfHasDebugStreamContainer condition wasn't satisfied.
That condition is

std::is_base_of<Container, T> OR QTypeTraits::has_ostream_operator<Stream, T>

Obviously, QStringList is not a base class of QString; we're expecting the
second check to be true, that there's an output streaming operator for QDebug-
QString

That of course is there; it's in QDebug itself.

So my conclusion is that your compiler has a bug and improperly parsed the C++
code. Does this problem happen with GCC 11 or 12?

I said gcc 10 earlier, but I meant to say clang 11. But I also see it in clang 14, and in VS 2019 (17.5.1 - latest).

It seems to be related to #including the moc output in the cpp file.


Here's a minimal example:

Header file:

#pragma once

#include <QObject>
#include <QString>

namespace TServer
{

        class Test : public QObject
        {
                Q_OBJECT

        private:
                void test();

        signals:
                void databaseOpened(QString schoolCode);
                void databaseEvent(QString schoolCode, QString notification);
                void databaseRemoved(QString schoolCode, QString dbFilename);
        };

}


Source file:

#include "server_database2.h"
#include <moc_server_database2.cpp>

#include <QDebug>


void TServer::Test::test()
{
        qDebug() << QStringList{};
}



Hamish

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to