From ab0aafbadf236cf0b849ca9298680d519dc2833e Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 29 Sep 2026 16:39:09 +0200 Subject: [PATCH] Fix CI: bind j_nested_const by reference in the json_pointer test clang-tidy (ci_clang_tidy) flagged the new test with performance-unnecessary-copy-initialization: the local copy j_nested_const of j_nested is never modified. Bind it as a const reference instead; it still exercises the const overloads of at() and contains(). Signed-off-by: Niels Lohmann --- tests/src/unit-json_pointer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/unit-json_pointer.cpp b/tests/src/unit-json_pointer.cpp index cb3a2f75d..76ae1f79b 100644 --- a/tests/src/unit-json_pointer.cpp +++ b/tests/src/unit-json_pointer.cpp @@ -384,7 +384,7 @@ TEST_CASE("JSON pointers") // contains() must not throw for an empty reference token if the current // value is an array (cf. #5395) -- at() still reports out_of_range.404 json j_nested = {{"a", {1, 2}}}; - const json j_nested_const = j_nested; + const json& j_nested_const = j_nested; json::json_pointer const jp("/a/"); std::string const throw_msg = "[json.exception.out_of_range.404] unresolved reference token ''";