From 01c22dfaeed4b98a447d8e03aa6d4a67a3ab23a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Wed, 14 Feb 2024 14:26:03 +0100 Subject: [PATCH] Range-for loop with const reference Prevent copy-ctor and dtor to be called. Found by Cppcheck (constVariableReference) --- Tests/CMakeLib/testDebuggerNamedPipe.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeLib/testDebuggerNamedPipe.cxx b/Tests/CMakeLib/testDebuggerNamedPipe.cxx index 1ae3f64484..67e13723d8 100644 --- a/Tests/CMakeLib/testDebuggerNamedPipe.cxx +++ b/Tests/CMakeLib/testDebuggerNamedPipe.cxx @@ -194,7 +194,7 @@ int runTest(int argc, char* argv[]) R"("command" *: *"disconnect".*"success" *: *true.*"type" *: *"response")" }; - for (auto& regexString : expectedResponses) { + for (const auto& regexString : expectedResponses) { cmsys::RegularExpression regex(regexString); if (!regex.find(debuggerResponse)) { std::cout << "Expected response not found: " << regexString << std::endl;