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

QMetaProperty has a different meta-type in inline namespace

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 6.8, 6.9
    • None
    • clang version 18.1.8
    • Linux/X11, macOS

    Description

      The issue is only reproducible with clang compilers on either macOS or linux platforms(I didn't test windows).

      The minimal reproducer can be found here: https://codereview.qt-project.org/c/qt/qtbase/+/583638

      The test creates a new library(either shared to static) that introduces Q_GADGET or Q_OBJECT with the property of a class-pointer type.

      The whole module is wrapped with inline and non-inline namespaces:

      inline namespace TestInlineNamespace {
      namespace TestNonInlineNamespace {
      
      class TypeA
      {
      };
      
      class INLINE_NAMESPACE_EXPORT TypeB : public QObject
      {
          Q_OBJECT
          Q_PROPERTY(TestInlineNamespace::TestNonInlineNamespace::TypeA *aProperty
                         READ aProperty WRITE setBProperty SCRIPTABLE false)
      
          TypeA *aProperty();
          void setBProperty(TypeA *aProperty);
      private:
          TypeA *m_aProperty;
      };
      
      class TypeC
      {
          Q_GADGET_EXPORT(INLINE_NAMESPACE_EXPORT)
          Q_PROPERTY(TestInlineNamespace::TestNonInlineNamespace::TypeA *aProperty
                         READ aProperty WRITE setBProperty SCRIPTABLE false)
      
          INLINE_NAMESPACE_EXPORT TypeA *aProperty();
          INLINE_NAMESPACE_EXPORT void setBProperty(TypeA *aProperty);
      
      private:
          TypeA *m_aProperty;
      };
      } // namespace TestNonInlineNamespace
      }
      

      Issue:
      When accessing the property metatype from the test, the aProperty metatype differs from the metatype for the TestInlineNamespace::TestNonInlineNamespace::TypeA * type.

      This only happens if another nested namespace is declared in the test, without the wrapping inline namespace:

      namespace TestNonInlineNamespace::Inner {
      }
      

      Also issue disappears if the inline namespace related sources are compiled as part of the tests, but not a separate library.

      It's most probably upstream clang issue.

      Attachments

        For Gerrit Dashboard: QTBUG-128168
        # Subject Branch Project Status CR V

        Activity

          People

            thiago Thiago Macieira
            semlanik Alexey Edelev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change