Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-139431

Miscompilation of lists of inline components

XMLWordPrintable

    • 56292c205 (dev), 7fd690a94 (6.10), 751c79764 (6.9), 6a841f802 (6.8)

      Consider:

      Window {
          width: 640
          height: 480
          visible: true
      
          component MyObject : QtObject
          {
              property real someVal
          }
      
          // property list<QtObject> myList: // WORKS
          property list<MyObject> myList: // DOESN'T WORK
          [
              MyObject { someVal: 3 },
              MyObject { someVal: 4 }
          ]
      
          property real currentVal: myList[0].someVal
      }
      

      When compiling this in direct mode, you get:

      /home/qt/listtest/build/6_8-Debug/.rcc/qmlcache/applisttest_Main_qml.cpp: In lambda function:
      /home/qt/listtest/build/6_8-Debug/.rcc/qmlcache/applisttest_Main_qml.cpp:225:86: error: wrong number of template arguments (0, should be 1)
        225 | aotContext->initLoadScopeObjectPropertyLookup(0, QMetaType::fromType<QQmlListProperty<>>());
            |                                                                                      ^
      In file included from /home/qt/qt6.8/qtbase/include/QtQml/qqmllist.h:1,
                       from /home/qt/qt6.8-src/qtdeclarative/src/qml/qml/qqmlprivate.h:20,
                       from /home/qt/qt6.8/qtbase/include/QtQml/qqmlprivate.h:1,
                       from /home/qt/listtest/build/6_8-Debug/.rcc/qmlcache/applisttest_Main_qml.cpp:2:
      /home/qt/qt6.8-src/qtdeclarative/src/qml/qml/qqmllist.h:24:7: note: provided for ‘template<class T> class QQmlListProperty’
         24 | class QQmlListProperty {
            |       ^~~~~~~~~~~~~~~~
      /home/qt/listtest/build/6_8-Debug/.rcc/qmlcache/applisttest_Main_qml.cpp:225:89: error: no matching function for call to ‘QMetaType::fromType<<expression error> >()’
        225 | aotContext->initLoadScopeObjectPropertyLookup(0, QMetaType::fromType<QQmlListProperty<>>());
            |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
      In file included from /home/qt/qt6.8/qtbase/include/QtCore/qmetatype.h:1,
                       from /home/qt/qt6.8-src/qtbase/src/corelib/kernel/qvariant.h:10,
                       from /home/qt/qt6.8/qtbase/include/QtCore/qvariant.h:1,
                       from /home/qt/qt6.8-src/qtdeclarative/src/qml/jsapi/qjsprimitivevalue.h:12,
                       from /home/qt/qt6.8/qtbase/include/QtQml/qjsprimitivevalue.h:1,
                       from /home/qt/qt6.8-src/qtdeclarative/src/qml/qml/qqmlprivate.h:18:
      /home/qt/qt6.8-src/qtbase/src/corelib/kernel/qmetatype.h:2647:21: note: candidate: ‘template<class T> static constexpr QMetaType QMetaType::fromType()’
       2647 | constexpr QMetaType QMetaType::fromType()
            |                     ^~~~~~~~~
      /home/qt/qt6.8-src/qtbase/src/corelib/kernel/qmetatype.h:2647:21: note:   template argument deduction/substitution failed:
      /home/qt/listtest/build/6_8-Debug/.rcc/qmlcache/applisttest_Main_qml.cpp:225:89: error: template argument 1 is invalid
        225 | aotContext->initLoadScopeObjectPropertyLookup(0, QMetaType::fromType<QQmlListProperty<>>());
            |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ulherman Ulf Hermann
            ulherman Ulf Hermann
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes