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

[MSVC] Build error C2440 for char8_t on Windows with option /std:c++20

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • None
    • Qt Creator 13.0.0-beta1
    • Building Qt Creator
    • None
    • OS: Windows server 2022
      VS: VS2022 17.7.5
    • Windows

    Description

      Commit: [f1085b3]https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=f1085b3

      Qt Creator failed to build with MSVC due to error C2440 under option /std:c++20 on Windows, reproduce steps and error message as follows. In addition, add /Zc:char8_t- could be a workaround.

      Steps to reproduce:
      Open VS2022 x64 Native Tools command.

      git clone https://code.qt.io/qt-creator/qt-creator.git
      cd qt-creator
      git reset --hard f1085b3
      
      cl.exe /nologo /TP /DAXIVION_LIBRARY /DAxivion_EXPORTS /DQT_CONCURRENT_LIB /DQT_CORE5COMPAT_LIB /DQT_CORE_LIB /DQT_CREATOR /DQT_DISABLE_DEPRECATED_BEFORE=0x050900 /DQT_GUI_LIB /DQT_NETWORK_LIB /DQT_NO_CAST_TO_ASCII /DQT_NO_DEBUG /DQT_NO_FOREACH /DQT_NO_JAVA_STYLE_ITERATORS /DQT_RESTRICTED_CAST_FROM_ASCII /DQT_USE_QSTRINGBUILDER /DQT_WIDGETS_LIB /DUNICODE /DWIN32 /DWIN64 /D_CRT_SECURE_NO_WARNINGS /D_ENABLE_EXTENDED_ALIGNED_STORAGE /D_SCL_SECURE_NO_WARNINGS /D_UNICODE /D_WIN64 /I"src\plugins\axivion" /I"src\libs" /external:I"F:\qt6\qt\6.3.2\msvc2019_64\include" /external:I"F:\qt6\qt\6.3.2\msvc2019_64\include\QtNetwork" /external:I"F:\qt6\qt\6.3.2\msvc2019_64\include\QtCore" /external:I"F:\qt6\qt\6.3.2\msvc2019_64\include\QtWidgets" /external:I"F:\qt6\qt\6.3.2\msvc2019_64\include\QtGui" /external:W0 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG /MD /wd4573 /W3 /Zc:__cplusplus /permissive- /utf-8 /FS /c /std:c++17 "src\plugins\axivion\dashboard\dashboardclient.cpp" /std:c++20

       
      Error info:

      dashboardclient.cpp
      src\plugins\axivion\dashboard\dashboardclient.cpp(82): error C2440: 'const_cast': cannot convert from 'const char8_t [7]' to 'char *'
      src\plugins\axivion\dashboard\dashboardclient.cpp(82): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
      src\plugins\axivion\dashboard\dashboardclient.cpp(82): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'QByteArrayData'
      src\plugins\axivion\dashboard\dashboardclient.cpp(82): note: 'QArrayDataPointer<char>::QArrayDataPointer': no overloaded function could convert all the argument types
      ...
      

      Attachments

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

        Activity

          People

            con Eike Ziller
            moyoumiu Youmiu Mo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes