Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.8.0
-
None
-
77b33e4b856c8c60993c0d65ad32c146e98c6701
Description
It is not possible to use the QImage header with clang-cl and Qt 5.8.0.
$ type ..\rref.cpp #include <QtGui/QImage> int main() { return 0; } $ C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe -Ic:\path\to\Qt\5.8.0\include -Xclang -fcxx-exceptions -Wno-microsoft-enum-value -fms-compatibility-version=19 ..\rref.cpp rref.cpp In file included from ..\rref.cpp:2: In file included from c:\path\to\include\QtGui/QImage:1: c:\path\to\QtGui/qimage.h(280,62): error: rvalue reference to type 'QImage' cannot bind to lvalue of type 'QImage' { mirrored_inplace(horizontally, vertically); return qMove(*this); } ^~~~~~~~~~~~ c:\path\to\QtCore/qcompilerdetection.h(1334,18): note: expanded from macro 'qMove' #define qMove(x) (x) ^~~ In file included from ..\rref.cpp:2: In file included from c:\path\to\QtGui/QImage:1: c:\path\to\QtGui/qimage.h(284,40): error: rvalue reference to type 'QImage' cannot bind to lvalue of type 'QImage' { rgbSwapped_inplace(); return qMove(*this); } ^~~~~~~~~~~~ c:\path\to\QtCore/qcompilerdetection.h(1334,18): note: expanded from macro 'qMove' #define qMove(x) (x) ^~~ 2 errors generated.
The problem is that `qMove` is not defined as `std::move` for clang-cl after "Windows: Disable unsupported C++11 features with Clang-cl and ICC" b5153d5bfab63da811b7a4615238d9e50198b412 https://codereview.qt-project.org/#/c/165502/ (see "Inplace versions of QImage rgbSwapped() and mirrored() for rvalue refs" b28764c641e4fef19d5e800b7537439fb2054914 https://codereview.qt-project.org/#/c/74636/ ). Reviewing that change now, I notice that the disabling of features is not versioned, and I don't understand why they are disabled. As far as I know, they should be enabled (note that with clang-cl you should probably always pass `-fms-compatibility-version=19`).
It is not clear to me where the `_HAS_RVALUE_REFERENCES` etc should be defined. Perhaps the user is to define them as a workaround for this kind of issue, so for now I will do that.