From ec266c7b1d7f93d2c8a38192e589d2ed1f7d6de0 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 1 Sep 2026 05:24:05 +0000 Subject: [PATCH] Use record_buffer::data() so clang does not flag it unneeded The record_buffer test type declares data() and size() so the is_contiguous_byte_container trait can see both and still reject the type on its value_type. data() was never called, so clang's -Wunneeded-member-function (under -Weverything -Werror) failed the C++20 build. Assert that data() points at the underlying bytes: it ODR-uses the member and documents the property the type is meant to demonstrate. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01XAYM1qhSA2FDaDcGfPW3fG Signed-off-by: Niels Lohmann --- tests/src/unit-user_defined_input.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/src/unit-user_defined_input.cpp b/tests/src/unit-user_defined_input.cpp index ff219eaa9..f07a8a608 100644 --- a/tests/src/unit-user_defined_input.cpp +++ b/tests/src/unit-user_defined_input.cpp @@ -272,6 +272,7 @@ TEST_CASE("Contiguous byte containers take the pointer adapter") // and such a container still parses through its iterators, in full - taking // it for a byte container would stop after data() + size() bytes const record_buffer buffer{"[1,2,3,4,5]"}; + CHECK(buffer.data() == buffer.bytes.data()); CHECK(buffer.size() * sizeof(record_buffer::value_type) < buffer.bytes.size()); CHECK(json::parse(buffer) == json({1, 2, 3, 4, 5})); }