From 9939913c8df0b9e3b5644a622f7d696883b94d82 Mon Sep 17 00:00:00 2001 From: hultonha Date: Tue, 13 Jul 2021 18:23:19 +0100 Subject: [PATCH 1/3] update MSVC to use new lambda processing Signed-off-by: hultonha --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index cad0e818cb..a1ded72255 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -77,6 +77,7 @@ ly_append_configurations_options( /Zc:forScope # Force Conformance in for Loop Scope /diagnostics:caret # Compiler diagnostic options: includes the column where the issue was found and places a caret (^) under the location in the line of code where the issue was detected. /Zc:__cplusplus + /Zc:lambda # Use the new lambda processor (See https://developercommunity.visualstudio.com/t/A-lambda-that-binds-the-this-pointer-w/1467873 for more details) /favor:AMD64 # Create Code optimized for 64 bit /bigobj # Increase number of sections in obj files. Profiling has shown no meaningful impact in memory nore build times COMPILATION_DEBUG From d69897fd86ab16e54ba531a8bffe2e250b3e942b Mon Sep 17 00:00:00 2001 From: hultonha Date: Wed, 14 Jul 2021 10:33:39 +0100 Subject: [PATCH 2/3] add [[maybe_unused]] attribute to prevent innocuous warning Signed-off-by: hultonha --- Code/Framework/AzCore/AzCore/Debug/Trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/AzCore/AzCore/Debug/Trace.h b/Code/Framework/AzCore/AzCore/Debug/Trace.h index 594322f1f3..ecf951ae6c 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Trace.h +++ b/Code/Framework/AzCore/AzCore/Debug/Trace.h @@ -127,7 +127,7 @@ namespace AZ #define AZ_TraceFmtCompileTimeCheck(expression, isVaArgs, baseMsg, msg, msgVargs) \ { \ using namespace AZ::TraceInternal; \ - const auto& rTraceFmtCompileTimeCheckExpressionHelper = (expression); /* This is needed for edge cases for expressions containing lambdas, that were unsupported before C++20 */ \ + [[maybe_unused]] const auto& rTraceFmtCompileTimeCheckExpressionHelper = (expression); /* This is needed for edge cases for expressions containing lambdas, that were unsupported before C++20 */ \ constexpr ExpressionValidResult isValidTraceFmtResult = ExpressionIsValid::value; \ /* Assert different message depending whether it's const char array or if we have extra arguments */ \ static_assert(!(isVaArgs) ? isValidTraceFmtResult != ExpressionValidResult::Invalid_ConstCharArray : true, baseMsg " " msg); \ From f8a80468ab27e34edc0d75d475da6928a645a8ec Mon Sep 17 00:00:00 2001 From: hultonha Date: Wed, 14 Jul 2021 13:13:28 +0100 Subject: [PATCH 3/3] remove structured binding from lambda to workaround msvc bug Signed-off-by: hultonha --- .../Components/MeshOptimizer/MeshOptimizerComponent.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshOptimizerComponent.cpp b/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshOptimizerComponent.cpp index e3eb617601..a5d5510f8a 100644 --- a/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshOptimizerComponent.cpp +++ b/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshOptimizerComponent.cpp @@ -493,7 +493,8 @@ namespace AZ::SceneGenerationComponents // Copy node attributes AZStd::apply([](const auto&&... nodePairView) { ((AZStd::for_each(begin(nodePairView), end(nodePairView), [](const auto& nodePair) { - auto& [originalNode, optimizedNode] = nodePair; + auto& originalNode = nodePair.first; + auto& optimizedNode = nodePair.second; optimizedNode->CloneAttributesFrom(&originalNode.get()); })), ...); }, std::tuple {