Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.15.1
-
None
Description
This code makes Qt log a warning:
QList<int> test;
test.insert(1, 0);
test.insert(0, 0);
The warning is:
QList::insert(): Index out of range
Using QList::reserve does not make a difference, even if the reserved size is orders of magnitude more than necessary. This still results in the warning:
QList<int> test;
test.reserve(2);
test.insert(1, 0);
test.insert(0, 0);
This does not warn:
QList<int> test;
test.insert(0, 0);
test.insert(1, 0);
This is a regression from Qt 5.14. I presume it is somehow related to the upcoming changes to memory management in QList in Qt6, but if so I would have expected using QList::reserve to resolve the warning.