From 99a26babb1dc42a83a73869883684b76a538047c Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sun, 6 Dec 2020 18:46:00 +1100 Subject: Cleanup: Fix warning about binding to a temporary in range-based for --- Source/cmLocalGenerator.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f582701..5f67e27 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3,6 +3,7 @@ #include "cmLocalGenerator.h" #include +#include #include #include #include @@ -2474,8 +2475,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) target->GetSourceFiles(sources, config); const std::string configUpper = cmSystemTools::UpperCase(config); + static const std::array langs = { { "C", "CXX", "OBJC", + "OBJCXX" } }; - for (const std::string& lang : { "C", "CXX", "OBJC", "OBJCXX" }) { + for (const std::string& lang : langs) { auto langSources = std::count_if( sources.begin(), sources.end(), [lang](cmSourceFile* sf) { return lang == sf->GetLanguage() && -- cgit v0.12