Details
-
Bug
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
5.15.0
-
None
Description
Executing the following code triggers an assert:
#include <QVariantList> #include <cassert> int main() { QVariantList l0; QVariantList l1; l0 << 1 << 2; l1 << 1 << 3; // this works as expected assert((l0 == l1) == (l1 == l0)); assert((l0 < l1) != (l1 < l0)); assert((l0 > l1) != (l1 > l0)); // here things get interesting QVariant v0(l0); QVariant v1(l1); assert((v0 == v1) == (v1 == v0)); assert((v0 < v1) != (v1 < v0)); //< assert! assert((v0 > v1) != (v1 > v0)); //< assert! return 0; }
I'd expect the QVariant::operator< to call the operator of the contained QVariantList which in turn compares its contents.
I can work around the issue by wrapping QVariant in a custom class that implements the lessThan-operator, or by using containers with custom comparators. Nonetheless, I think this should be addressed...
note: I could only test this in Qt 5.9.7 on windows, but the same effect manifests itself under Qt5.15 on MacOS.