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

Qt 6.0.0 Alpha App fails to compile with MSVC and /std:c++latest

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 6.0.0 Alpha
    • Core: Object Model
    • None
    • Visual Studio 2019 version 16.8 Preview 3.2
    • Windows
    • 8ccae33a8114ea7da49701b5d7c9f6733a219711 (qt/qtbase/dev)

    Description

      MSVC fail to compile apps using Qt when using /std:c++latest flag. This does not happen with Qt 5.15.0 and early. Being that I use Cpp20 features often, not being able to use this flag is a problem.

      Error messages:

      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(2310): error C2370: 'QtPrivate::QMetaTypeForType<S>::name': redefinition; different storage class
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(2220): note: see declaration of 'QtPrivate::QMetaTypeForType<S>::name'
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(2310): error C2059: syntax error: '='
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(2310): error C2065: 'T': undeclared identifier
      

      This error message was generated using the code and command below

      #include <QApplication>
      #include <QMainWindow>
      class MainWindow : public QMainWindow
      {
          Q_OBJECT
      public:
          MainWindow (QWidget *parent = 0) : QMainWindow(parent) {};
          ~MainWindow(                   ) {};
      };
      
      int main(int argc, char *argv[]){
          QApplication app(argc, argv);
          MainWindow main_window;
          main_window.show();
          return app.exec();
      }
      
      cl.exe /nologo /TP -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_WINMAIN_LIB -DUNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -IC:\Qt\6.0.0\msvc2019_64\include\QtCore -IC:\Qt\6.0.0\msvc2019_64\mkspecs\win32-msvc -IC:\Qt\6.0.0\msvc2019_64\include -IC:\Qt\6.0.0\msvc2019_64\include\QtGui -IC:\VulkanSDK\1.2.135.0\Include -IC:\Qt\6.0.0\msvc2019_64\include\QtWidgets /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 -Zc:__cplusplus -utf-8 -std:c++latest /FoCMakeFiles\msmanager.dir\main.cpp.obj /FS -c main.cpp
      

      Attachments

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

        Activity

          People

            laknoll Lars Knoll
            link1j Jared Irwin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes