From 8cb832090a8a0e7226904561f97c6de954d752ed Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Thu, 25 Aug 2022 10:36:48 +0800 Subject: MSVC: Enable all possible conformance checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the full list, please refer to [1]. Needed to change the qstringapisymmetry unit test: In theory we don't need the array to be static and it did compile without any problems so far, indeed. However, with this patch applied, MSVC complains that the lambda function below can't access the array. I don't understand why, because we use [&] in the lambda and it should capture all the variables in theory, but in reality it failed to capture this variable in the end. And making the variable static solves this issue. Maybe it's a MSVC bug. Already tested locally. Most Qt repos build without any issues, only very few repos are not tested, as my local environment can't build them. [1] https://docs.microsoft.com/en-us/cpp/build/reference/zc-conformance?view=msvc-170 Change-Id: I658427aa171ee1ae26610d0c68640b2f50789f15 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira Reviewed-by: Jörg Bornemann --- cmake/QtInternalTargets.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 13da9775f0..9dbf63000c 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -239,14 +239,17 @@ if (MSVC) ) endif() endif() - if (MSVC_VERSION GREATER_EQUAL 1909 AND NOT CLANG) + if (MSVC_VERSION GREATER_EQUAL 1909 AND NOT CLANG) # MSVC 2017 target_compile_options(PlatformCommonInternal INTERFACE -Zc:referenceBinding + -Zc:ternary ) endif() - if (MSVC_VERSION GREATER_EQUAL 1919 AND NOT CLANG) + if (MSVC_VERSION GREATER_EQUAL 1919 AND NOT CLANG) # MSVC 2019 target_compile_options(PlatformCommonInternal INTERFACE -Zc:externConstexpr + -Zc:lambda + -Zc:preprocessor ) endif() -- cgit v1.2.3