Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-24580

Qt 6.0.0-0-202008280953 causes code model to complain about parsing Qt files

    XMLWordPrintable

Details

    • Windows
    • 370804c2ab307cc9dfbcd5566e7625e0996f1f9e (qt-creator/qt-creator/4.14)

    Description

      MSVC 2019 x64, Qt 6.0.0-0-202008280953 and 20200917164

      After creating a new Qt Widgets example with either CMake or QMake, the code model complains:

      qmetatype.h:2642:31: error: constexpr variable 'begin' must be initialized by a constant expression
      main.cpp:1:1: note: in file included from C:\Qt\Examples\Qt-6.0.0\widgets\itemviews\addressbook\main.cpp:1:
      main.cpp:51:10: note: in file included from C:\Qt\Examples\Qt-6.0.0\widgets\itemviews\addressbook\main.cpp:51:
      mainwindow.h:54:10: note: in file included from C:\Qt\Examples\Qt-6.0.0\widgets\itemviews\addressbook\mainwindow.h:54:
      addresswidget.h:54:10: note: in file included from C:\Qt\Examples\Qt-6.0.0\widgets\itemviews\addressbook\addresswidget.h:54:
      newaddresstab.h:54:10: note: in file included from C:\Qt\Examples\Qt-6.0.0\widgets\itemviews\addressbook\newaddresstab.h:54:
      QWidget:1:10: note: in file included from C:\Qt\6.0.0\msvc2019_64\include\QtWidgets\QWidget:1:
      qwidget.h:45:10: note: in file included from C:\Qt\6.0.0\msvc2019_64\include\QtWidgets\qwidget.h:45:
      qobject.h:54:10: note: in file included from C:\Qt\6.0.0\msvc2019_64\include\QtCore\qobject.h:54:
      qmetatype.h:2642:44: note: cannot refer to element 39 of array of 1 element in a constant expression
      
      #if !(defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG))
              constexpr auto func = Q_FUNC_INFO;
              constexpr const char *begin = func + prefix;
              constexpr const char *end = func + sizeof(Q_FUNC_INFO) - suffix;
              constexpr int len = qNormalizeType(begin, end, nullptr);
      #else // GCC < 8.1 did not have Q_FUNC_INFO as constexpr, and GCC 9 has a precompiled header bug
              auto func = Q_FUNC_INFO;
              const char *begin = func + prefix;
              const char *end = func + sizeof(Q_FUNC_INFO) - suffix;
              // This is an upper bound of the size since the normalized signature should always be smaller
              // (Unless there is a QList -> QVector change, but that should not happen)
              constexpr int len = sizeof(Q_FUNC_INFO) - suffix - prefix;
      #endif
              std::array<char, len + 1> result {};
              qNormalizeType(begin, end, result.data());
              return result;
          }
      }
      

      There is a confusion about Q_CC_CLANG, MSVC2019 and the code above

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-24580
        # Subject Branch Project Status CR V

        Activity

          People

            kandeler Christian Kandeler
            cadam Cristian Adam
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes