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

Q_INVOKABLE not working with placeholder type specifier (auto)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • 6.1.1, 6.2
    • 5.12
    • Build tools: moc
    • None
    • 12b8283f899ebcf401d974927314b9531334a56e

      When declaring a function prepended by a Q_INVOKABLE, the moc is only able to generate an invokable function in the meta object when not using a placeholder type specifier auto.

      E.g. the following declaration is being generated correctly

      Q_INVOKABLE 
      qint32 find(const QString &);
      

      but this ones is not:

      Q_INVOKABLE 
      auto find(const QString &) -> qint32;
      

      Reading the docs, it is stated that the macro should be placed in front of the return type. So even trying weird things like

       auto find(const QString &) -> Q_INVOKABLE qint32;
      

      does not work.

      There is a simple workaround by not using auto in the first place. But in order to provide a clean interface definition in the header file it would be great to be able to use auto.

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

            fabiankosmale Fabian Kosmale
            mlthlschr Malte Hölscher
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes