From 72c51f59dc75f52c6603e034bc8c631d9cc285d4 Mon Sep 17 00:00:00 2001 From: Adam Panzica Date: Fri, 10 Jul 2026 15:50:07 -0400 Subject: [PATCH] fix(tests): read cbor byte view via std::span, not basic_string_view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libc++ shipped with Xcode 26.5 (the current macos-latest runner image) deprecates std::char_traits for T outside {char, wchar_t, char8_t, char16_t, char32_t}. std::basic_string_view instantiates the now-deprecated std::char_traits, and tests build with -Werror, so tests/cbor/test_read_byte_containers.cpp fails to compile on macos-latest (the only matrix cell that both compiles the tests and uses the new libc++). Switch the byte view to std::span. It is the idiomatic non-owning byte view, does not depend on char_traits at all, and satisfies the same rfl::concepts::ContiguousByteContainer that rfl::cbor::read requires — so the test exercises the identical read overload. The sibling std::uint8_t-array test is unchanged. This library specialization is slated for removal, not just deprecation, so migrating off it is the durable fix rather than suppressing the warning. --- tests/cbor/test_read_byte_containers.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/cbor/test_read_byte_containers.cpp b/tests/cbor/test_read_byte_containers.cpp index ed863b469..660b60ff7 100644 --- a/tests/cbor/test_read_byte_containers.cpp +++ b/tests/cbor/test_read_byte_containers.cpp @@ -2,7 +2,9 @@ #include #include +#include #include +#include // Make sure things still compile when // rfl.hpp is included after rfl/cbor.hpp. @@ -31,8 +33,13 @@ TEST(cbor, test_read_from_byte_view) { std::transform(rfl_buffer.begin(), rfl_buffer.end(), my_buffer.begin(), [](char c) { return static_cast(c); }); - std::basic_string_view byte_view(my_buffer.data(), - rfl_buffer.size()); + // Note: std::span rather than + // std::basic_string_view. libc++ (Xcode 26.5+) deprecates + // std::char_traits — the non-standard specialization that a + // basic_string_view instantiates — which is a hard error under + // -Werror. A span is the idiomatic non-owning byte view and exercises the + // same rfl::cbor::read overload (concepts::ContiguousByteContainer). + std::span byte_view(my_buffer.data(), rfl_buffer.size()); auto result = rfl::cbor::read(byte_view); EXPECT_TRUE(result);