Details
-
Bug
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
6.2.3
-
None
Description
The attached example compiles and runs fine in Qt5 or in all Qt Version when using std::vector or std::list.
But using Qt6 and QVector/QList the compiler insists on using the Copy Assignment Constructor which, of course, is deleted. Because the class has const members.
class TestClassConst { public: TestClassConst() = delete; TestClassConst(int i, const QString &str) : a(i), string(str) {} private: const int a = 0; const QString string; }; int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QVector<TestClassConst> list; // std::vector<TestClassConst> list; // std::list<TestClassConst>list; for(int i = 0; i < 10; ++i){ list.append(TestClassConst{i, QString::number(i)}); } return app.exec(); }
I would have expected that `emplaceBack(i, QString::number)` would at least work, but that also insists on using the copy assignment operator.
I don't think this is working as intended.
Attachments
Issue Links
- relates to
-
QTBUG-101701 [REG 5.15 -> 6.0]: QVector can no longer insert classes that contain const non-POD members
-
- Closed
-