mirror of
https://github.com/nlohmann/json.git
synced 2026-09-01 14:07:14 +00:00
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:
@@ -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}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user