Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.3.0 Beta1
-
None
-
49722de995 (qt/qtbase/dev) 49722de995 (qt/tqtc-qtbase/dev) a19d1174f6 (qt/qtbase/6.3) a19d1174f6 (qt/tqtc-qtbase/6.3) a19d1174f6 (qt/tqtc-qtbase/6.3.0)
Description
I tried our application with 6.3.0-beta1. But it cannot compile this anymore
#include <QMap> #include <QObject> #include <QWeakPointer> class Example : public QObject { Q_OBJECT }; int main(int argc, char** argv) { QMap<QString, QWeakPointer<QObject>> instances; auto shared = QSharedPointer<Example>::create(); // broken instances.insert(QStringLiteral("1"), shared.toWeakRef()); // works auto tmp = shared.toWeakRef(); instances.insert(QStringLiteral("2"), tmp); return 0; } #include "main.moc"
/.../libs/qt6/dist/include/QtCore/qsharedpointer_impl.h: In instantiation of 'QWeakPointer<T>::QWeakPointer(QWeakPointer<X>&&) [with X = Example; typename std::enable_if<std::is_convertible<_Up*, _Tp*>::value, bool>::type <anonymous> = true; T = QObject]': /.../libs/qt6/dist/include/QtCore/qsharedpointer_impl.h:589:19: error: 'QWeakPointer<Example>::Data* QWeakPointer<Example>::d' is private within this context 589 | : d(other.d), value(other.value) | ~~~~~~^ /.../libs/qt6/dist/include/QtCore/qsharedpointer_impl.h:719:11: note: declared private here 719 | Data *d; | ^ /.../libs/qt6/dist/include/QtCore/qsharedpointer_impl.h:589:35: error: 'Example* QWeakPointer<Example>::value' is private within this context 589 | : d(other.d), value(other.value) | ~~~~~~^~~~~ /.../libs/qt6/dist/include/QtCore/qsharedpointer_impl.h:720:8: note: declared private here 720 | T *value; | ^~~~~ /.../libs/qt6/dist/include/QtCore/qsharedpointer_impl.h:591:15: error: 'QWeakPointer<Example>::Data* QWeakPointer<Example>::d' is private within this context 591 | other.d = nullptr; | ~~~~~~^ /.../libs/qt6/dist/include/QtCore/qsharedpointer_impl.h:719:11: note: declared private here 719 | Data *d; | ^ /.../libs/qt6/dist/include/QtCore/qsharedpointer_impl.h:592:15: error: 'Example* QWeakPointer<Example>::value' is private within this context 592 | other.value = nullptr; | ~~~~~~^~~~~ /.../libs/qt6/dist/include/QtCore/qsharedpointer_impl.h:720:8: note: declared private here 720 | T *value; | ^~~~~