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

moc can no longer create meta objects for private classes (that aren't Q_OBJECT themselves)

    XMLWordPrintable

Details

    • a017ee967 (dev), 7971dd213 (6.8), cecca90ff (dev)

    Description

      After da4a6cf78ff42a4f69c2775997ff174ef647f3f3, moc generates code that is slightly different from the previous, resulting in a different behaviour mode for:

      class Outer
      {
          class Inner;
      };
      class Outer::Inner : public QObject
      {
          Q_OBJECT
      };
      

      This no longer compiles because class Outer::Inner is private and we can't therefore write:

      template <> constexpr inline auto qt_call_create_metaobjectdata<TAG>()
      {
          return Outer::Inner::qt_create_metaobjectdata<TAG>();
      }
      

      Note that meta objects for private classes were not working properly before this change either. The following would fail to compile (and has been failing since 4.0):

      class Outer
      {
          class Inner;
      };
      class Outer::Inner : public QObject 
      {
          Q_OBJECT
          enum E { V };
          Q_ENUM(E)
      };
      

      And the following even fails to moc:

      class Outer
      {
          class Inner : public QObject {
              Q_OBJECT
          };
      };
      

      Output:

      standard input:4:1: error: Meta object features not supported for nested classes
      

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              thiago Thiago Macieira
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes