From 840a7cbc11dec83c1877e4d977a7533c4e7c2f96 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 11 Jul 2026 23:50:05 +0200 Subject: [PATCH] Fix clang-tidy misc-const-correctness in counted_iterator test first/first2 are passed by value into json::parse/accept and never mutated afterward in this scope, so clang-tidy correctly flags them as const-able. Verified clean against the exact CI job (silkeh/clang:dev, ci_clang_tidy target, C++20 compile command). Signed-off-by: Niels Lohmann --- tests/src/unit-user_defined_input.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/unit-user_defined_input.cpp b/tests/src/unit-user_defined_input.cpp index 6dd6100e0..823e82862 100644 --- a/tests/src/unit-user_defined_input.cpp +++ b/tests/src/unit-user_defined_input.cpp @@ -220,12 +220,12 @@ TEST_CASE("Parse with std::counted_iterator and std::default_sentinel_t") const std::string json_str = R"({"key":"value","array":[1,2,3]})"; const auto len = static_cast>(json_str.size()); - std::counted_iterator first(json_str.begin(), len); + const std::counted_iterator first(json_str.begin(), len); const json j = json::parse(first, std::default_sentinel); CHECK(j["key"] == "value"); CHECK(j["array"].size() == 3); - std::counted_iterator first2(json_str.begin(), len); + const std::counted_iterator first2(json_str.begin(), len); CHECK(json::accept(first2, std::default_sentinel)); } #endif