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

REG: QML_ELEMENT breaks compilation for list reference arguments

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.4.0 Beta3
    • Build tools: moc
    • None
    • All

    Description

      For whatever reason, we've a slot definition that receives a Reference to a list type like this:

      private slots:
          void foo(QStringList& bar) { Q_UNUSED(bar) }
      

      Having this kind of reference in a signal or slot breaks the compilation when QML_ELEMENT is present:

      In file included from /home/me/Qt/6.4.0/gcc_64/include/QtCore/qobject.h:18, from /home/me/Qt/6.4.0/gcc_64/include/QtCore/QObject:1, from /home/me/tmp/build-untitled-Desktop_Qt_6_4_0_GCC_64bit-Debug/untitled_autogen/EWIEGA46WW/../../../untitled/droggelbecher.h:3, from /home/me/tmp/build-untitled-Desktop_Qt_6_4_0_GCC_64bit-Debug/untitled_autogen/EWIEGA46WW/moc_droggelbecher.cpp:10, from /home/me/tmp/build-untitled-Desktop_Qt_6_4_0_GCC_64bit-Debug/untitled_autogen/mocs_compilation.cpp:2: /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h: In instantiation of ‘static constexpr const char* QtPrivate::QMetaTypeForType<S>::getName() [with S = QList<QString>&]’: /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h:2347:48: required from ‘constexpr const QtPrivate::QMetaTypeInterface QtPrivate::QMetaTypeInterfaceWrapper<QList<QString>&>::metaType’ /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h:2446:12: required from ‘constexpr const QtPrivate::QMetaTypeInterface* QtPrivate::qMetaTypeInterfaceForType() [with T = QList<QString>&]’ /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h:2498:44: required from ‘constexpr const QtPrivate::QMetaTypeInterface* const qt_metaTypeArray [3]<Droggelbecher, void, QList<QString>&>’ /home/me/tmp/build-untitled-Desktop_Qt_6_4_0_GCC_64bit-Debug/untitled_autogen/EWIEGA46WW/moc_droggelbecher.cpp:92:5: required from here /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h:2329:45: error: ‘IsBuiltIn’ is not a member of ‘QMetaTypeId2<QList<QString>&>’ 2329 | if constexpr (bool(QMetaTypeId2<S>::IsBuiltIn)) { | ^~~~~~~~~ /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h:2330:49: error: ‘nameAsArray’ is not a member of ‘QMetaTypeId2<QList<QString>&>’ 2330 | return QMetaTypeId2<S>::nameAsArray.data(); | ~~~~~~~~~~~~^~~~ /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h: In instantiation of ‘constexpr const QtPrivate::QMetaTypeInterface QtPrivate::QMetaTypeInterfaceWrapper<QList<QString>&>::metaType’: /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h:2446:12: required from ‘constexpr const QtPrivate::QMetaTypeInterface* QtPrivate::qMetaTypeInterfaceForType() [with T = QList<QString>&]’ /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h:2498:44: required from ‘constexpr const QtPrivate::QMetaTypeInterface* const qt_metaTypeArray [3]<Droggelbecher, void, QList<QString>&>’ /home/me/tmp/build-untitled-Desktop_Qt_6_4_0_GCC_64bit-Debug/untitled_autogen/EWIEGA46WW/moc_droggelbecher.cpp:92:5: required from here /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h:2347:48: error: ‘static constexpr const char* QtPrivate::QMetaTypeForType<S>::getName() [with S = QList<QString>&]’ called in a constant expression 2347 | /*.name=*/ QMetaTypeForType<T>::getName(), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ /home/me/Qt/6.4.0/gcc_64/include/QtCore/qmetatype.h:2327:34: note: ‘static constexpr const char* QtPrivate::QMetaTypeForType<S>::getName() [with S = QList<QString>&]’ is not usable as a ‘constexpr’ function because: 2327 | static constexpr const char *getName() | ^~~~~~~

      Whether that makes sense or not - versions < 6.4.0beta2 compile fine here. Removing the reference resolves the problem.

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            cajus Cajus Pollmeier
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes