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

Failed to compile QML app with VS2019

    XMLWordPrintable

Details

    • Windows
    • 31f874520 (dev), c289ed4f9 (6.6)

    Description

      When I compiled a qtquick program with Qt 6.6.0 + VS2019, I got these errors

      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(23): warning C4003: not enough arguments for function-like macro invocation 'min'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(24): warning C4003: not enough arguments for function-like macro invocation 'max'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(35): warning C4003: not enough arguments for function-like macro invocation 'max'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(47): warning C4003: not enough arguments for function-like macro invocation 'min'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(47): warning C4003: not enough arguments for function-like macro invocation 'max'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(23): error C2589: '(': illegal token on right side of '::'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(23): error C2062: type 'unknown-type' unexpected
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(24): error C2589: '(': illegal token on right side of '::'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(24): error C2059: syntax error: ')'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(24): error C2143: syntax error: missing ';' before '{'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(19): error C3615: constexpr function 'QJSNumberCoercion::isInteger' cannot result in a constant expression
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(29): note: failure was caused by control reaching the end of a constexpr function
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(35): error C2589: '(': illegal token on right side of '::'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(35): error C2062: type 'unknown-type' unexpected
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(35): error C2059: syntax error: ')'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(35): error C2143: syntax error: missing ';' before '{'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(33): error C3615: constexpr function 'QJSNumberCoercion::isArrayIndex' cannot result in a constant expression
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(40): note: failure was caused by control reaching the end of a constexpr function
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(47): error C2589: '(': illegal token on right side of '::'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(47): error C2062: type 'unknown-type' unexpected
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(47): error C2589: '(': illegal token on right side of '::'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(47): error C2059: syntax error: ')'
      D:\Qt\6.6.0\msvc2019_64\include\QtQml/qjsnumbercoercion.h(47): error C2143: syntax error: missing ';' before '{' 

       
      I have to change all 

      std::numeric_limits<int>::min()
      std::numeric_limits<int>::max()

       into

      (std::numeric_limits<int>::min)()
      (std::numeric_limits<int>::max)()

      in qjsnumbercoercion.h to compile successfully.

      This problem only occurs when using the VC++ compiler, not with gcc. It looks like the compiler is confusing the methods in std::numeric_limits<int> with the macros defined by VC++.

       

       

       

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            xuzhen xuzhen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes