Skip to content
  • Nikolai Kosjar's avatar
    Clang Static Analyzer: Workaround analyzing MSVC2015 projects with clang 3.8.0 II · d13d1795
    Nikolai Kosjar authored
    clang 3.8.0 predefines language feature macros (__cpp_*), but clang 3.6.2 and
    MSVC2015 do not. Plus, there is a mismatch between Q_COMPILER_CONSTEXPR and
    Q_DECL_CONSTEXPR if those language feature macros are defined. The latter is
    fixed for Qt 5.8.0 [1]. Together, this leads to the following error:
    
      In file included from D:\work\testprojects\qt-widgets-app\mainwindow.cpp:1:
      In file included from D:/work/testprojects/qt-widgets-app/mainwindow.h:4:
      In file included from D:/usr/qt-5.6.0-msvc2015_32/5.6/msvc2015/include/QtWidgets\QMainWindow:1:
      In file included from D:/usr/qt-5.6.0-msvc2015_32/5.6/msvc2015/include/QtWidgets/qmainwindow.h:37:
      In file included from D:/usr/qt-5.6.0-msvc2015_32/5.6/msvc2015/include\QtWidgets/qwidget.h:41:
      In file included from D:/usr/qt-5.6.0-msvc2015_32/5.6/msvc2015/include\QtGui/qpalette.h:38:
      In file included from D:/usr/qt-5.6.0-msvc2015_32/5.6/msvc2015/include\QtGui/qcolor.h:40:
      D:/usr/qt-5.6.0-msvc2015_32/5.6/msvc2015/include\QtGui/qrgba64.h(72,13) :  error: constexpr function never produces a constant expression [-Winvalid-constexpr]
          QRgba64 fromRgba64(quint64 c)
                  ^
      D:/usr/qt-5.6.0-msvc2015_32/5.6/msvc2015/include\QtGui/qrgba64.h(77,17) :  note: non-constexpr constructor 'QRgba64' cannot be used in a constant expression
              QRgba64 rgba64;
                      ^
      D:/usr/qt-5.6.0-msvc2015_32/5.6/msvc2015/include\QtGui/qrgba64.h(42,7) :  note: declared here
      class QRgba64 {
            ^
      1 error generated.
    
    [1] https://codereview.qt-project.org/#/c/149027
    
    
    
    Task-number: QTCREATORBUG-15940
    Change-Id: I54e22d15981e7ff83fff8184db616641429e2178
    Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
    d13d1795