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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAYM1qhSA2FDaDcGfPW3fG
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-09-01 05:24:05 +00:00
committed by Claude
co-authored by Claude
parent 0386005cbd
commit ec266c7b1d
+1
View File
@@ -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 // and such a container still parses through its iterators, in full - taking
// it for a byte container would stop after data() + size() bytes // it for a byte container would stop after data() + size() bytes
const record_buffer buffer{"[1,2,3,4,5]"}; 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(buffer.size() * sizeof(record_buffer::value_type) < buffer.bytes.size());
CHECK(json::parse(buffer) == json({1, 2, 3, 4, 5})); CHECK(json::parse(buffer) == json({1, 2, 3, 4, 5}));
} }