Fix kea build with libc++ 19
As noted in the libc++ 19 release notes, std::char_traits<>
is now only provided for char
, char8_t
, char16_t
, char32_t
and wchar_t
, and any instantiation for other types will fail.
This also affects instantiations of std::basic_string<>
, such as std::basic_string<uint8_t>
, which is used in kea. It results in compilation errors with libc++ 19 (I'm currently doing a round of port builds for FreeBSD with llvm, clang and libc++ 19 in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280562):
In file included from edns.cc:9:
In file included from ../../../src/lib/exceptions/exceptions.h:11:
/usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
820 | static_assert(is_same<_CharT, typename traits_type::char_type>::value,
| ^
../../../src/lib/dns/name.h:727:16: note: in instantiation of template class 'std::basic_string<unsigned char>' requested here
727 | NameString ndata_;
| ^
/usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
| ^
NameString
is currently defined as std::basic_string<uint8_t>
but it is relatively easy to replace with std::vector<uint8_t>
; I created a patch for this. Alternatively, a regular std::string
could be used, but it is rather annoying to have to cast from uint8_t
to char
and back at various places.
I am currently not able to fork, but if @tomek, @vicky, @ondrej can give me access to do so, I will submit a Merge Request. Alternatively, I can submit a Pull Request on GitHub, or simply attach a patch file here.