From c341de70eecdefd72dd80080f91abc04d04f0ebb Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 9 Oct 2026 18:21:54 +0200 Subject: [PATCH] Use a named document in the dump test: root() of a temporary does not compile Signed-off-by: Niels Lohmann --- tests/src/unit-json_view.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/src/unit-json_view.cpp b/tests/src/unit-json_view.cpp index 1ce19953e..7499d04d4 100644 --- a/tests/src/unit-json_view.cpp +++ b/tests/src/unit-json_view.cpp @@ -1427,7 +1427,8 @@ TEST_CASE("json_view dump") many_tokens += (i != 0 ? "," : "") + token; } many_tokens += ']'; - CHECK(json_document::parse(many_tokens).root().dump() == json::parse(many_tokens).dump()); + const json_document many_doc = json_document::parse(many_tokens); + CHECK(many_doc.root().dump() == json::parse(many_tokens).dump()); } // random doubles, written as parse() and dump() would