Hello!
With QT6.11, we get the following warning when including include!("cxx-qt-lib/qstring.h");:
Logs
warning: backend@0.1.0: In file included from /usr/include/qt6/QtCore/qstring.h:15,
warning: backend@0.1.0: from /usr/include/qt6/QtCore/qhashfunctions.h:10,
warning: backend@0.1.0: from /usr/include/qt6/QtCore/qlist.h:12,
warning: backend@0.1.0: from /usr/include/qt6/QtCore/qstringlist.h:6,
warning: backend@0.1.0: from /usr/include/qt6/QtCore/QStringList:1,
warning: backend@0.1.0: from /home/maxi/Workspace/qtrs-example/backend/target/debug/build/backend/6c8c562bccc442b2/out/cxxqtbuild/include/cxx-qt-lib/core/qstring.h:11,
warning: backend@0.1.0: from /home/maxi/Workspace/qtrs-example/backend/target/debug/build/backend/6c8c562bccc442b2/out/cxxqtbuild/include/cxx-qt-lib/qstring.h:9,
warning: backend@0.1.0: from /home/maxi/Workspace/qtrs-example/backend/target/debug/build/backend/6c8c562bccc442b2/out/cxxqtgen/src/backend.cxx.cpp:1:
warning: backend@0.1.0: /usr/include/qt6/QtCore/qchar.h:48:31: warning: defining 'QChar', which previously failed to be complete in a SFINAE context [-Wsfinae-incomplete=]
warning: backend@0.1.0: 48 | class QT6_ONLY(Q_CORE_EXPORT) QChar {
warning: backend@0.1.0: | ^~~~~
warning: backend@0.1.0: In file included from /usr/include/c++/16/unordered_map:44,
warning: backend@0.1.0: from /usr/include/c++/16/functional:80,
warning: backend@0.1.0: from /usr/include/qt6/QtCore/qcomparehelpers.h:29,
warning: backend@0.1.0: from /usr/include/qt6/QtCore/qcompare.h:661,
warning: backend@0.1.0: from /usr/include/qt6/QtCore/qnamespace.h:14,
warning: backend@0.1.0: from /usr/include/qt6/QtCore/qbytearray.h:10,
warning: backend@0.1.0: from /usr/include/qt6/QtCore/QByteArray:1,
warning: backend@0.1.0: from /home/maxi/Workspace/qtrs-example/backend/target/debug/build/backend/6c8c562bccc442b2/out/cxxqtbuild/include/cxx-qt-lib/core/qstring.h:10:
warning: backend@0.1.0: /usr/include/c++/16/bits/range_access.h:325:24: note: here. Use '-Wsfinae-incomplete=2' for a diagnostic at that point
warning: backend@0.1.0: 325 | -> decltype(__cont.data())
warning: backend@0.1.0: | ~~~~~~~^~~~I have figured out that the problem probably comes from a bug in Qt6.11, as the logs suggest in potentially qbytearray.h, or further down the line. The problem is that QChar is referenced before being (fully) defined.
Your qstring.h file includes the following:
#include <QtCore/QByteArray>
#include <QtCore/QStringList>
#include "rust/cxx.h"I played around and added the following:
#include <QtCore/QChar>
#include <QtCore/QByteArray>
#include <QtCore/QStringList>
#include "rust/cxx.h"This solved the warning. Would you believe this to be a valid fix? I don't want you to fix Qt's problems, but this include should be backwards and forwards compatible, and should be sound over all, I think.
For me personally, as a workaround, it also worked to include that header myself:
#[cxx_qt::bridge]
mod ffi {
unsafe extern "C++" {
// workaround:
include!(<QtCore/QChar>);
include!("cxx-qt-lib/qstring.h");
type QString = cxx_qt_lib::QString;
}
}I have found very few mentions of this issue, so maybe I'm alone here (it could also be that search engines are getting useless and there are more people):
https://github.com/mappu/miqt/issues/335
https://redmine.freeciv.org/journals/6476/diff?detail_id=10583If there is interest, I may try creating a minimal repro
I am on arch linux, qt6-base 6.11.2-3
Activity
2Seems like this is potentially an upstream regression with Qt combined with gcc 16 ? Unclear if we should do anything here downstream or wait to see if it is solved upstream?
Actually, changing the order and simply including
<QtCore/QStringList>before<QtCore/QByteArray>also works (even without including QChar), since<QtCore/QStringList>includes qstring, and therefore qchar. This is further evidence that the problem is in QByteArray (I believe). This may also affect yourqbytearray.hfile, though I didn't test that.