From 73227258b05ff3aa2a92a18048d3d216bdefa230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20De=20Canni=C3=A8re?= Date: Fri, 14 Feb 2025 11:08:50 +0100 Subject: Compiler: Add missing conversion for variant equality comparisons The comparison code was generated properly but the conversion to safely assign the result of the comparison to the out accumulator was missing. Amends 78b58582baccb2c214dfb07083e91eb47e45358a Fixes: QTBUG-133636 Pick-to: 6.9 6.8 Change-Id: I9f790b449b48c382064954ad4235d25d221f1168 Reviewed-by: Ulf Hermann --- tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp') diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 673155119b..83a31b3f1c 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -108,6 +108,7 @@ private slots: void equalityTestsWithNullOrUndefined(); void equalityVarAndNonStorable(); void equalityVarAndStorable(); + void equalityVarWithOutConversion(); void equalsUndefined(); void evadingAmbiguity(); void exceptionFromInner(); @@ -1901,6 +1902,20 @@ void tst_QmlCppCodegen::equalityVarAndStorable() QMetaObject::invokeMethod(p.data(), "verify", 11); } +void tst_QmlCppCodegen::equalityVarWithOutConversion() +{ + QQmlEngine engine; + QUrl url(u"qrc:/qt/qml/TestTypes/equalityVarWithOutConversion.qml"_s); + QQmlComponent component(&engine, url); + QVERIFY2(!component.isError(), component.errorString().toUtf8()); + QScopedPointer o(component.create()); + QVERIFY(!o.isNull()); + + auto ss = o->property("ss").value(); + QQmlExpression expr(ss); + expr.evaluate(); +} + void tst_QmlCppCodegen::equalsUndefined() { QQmlEngine engine; -- cgit v1.2.3