maintainer-feedback requested: [Bug 281516] graphics/libemf: fix build with libc++ 19
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 281516] graphics/libemf: fix build with libc++ 19"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 15 Sep 2024 11:54:30 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked FreeBSD Office Team <office@FreeBSD.org> for maintainer-feedback: Bug 281516: graphics/libemf: fix build with libc++ 19 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281516 --- Description --- As noted in the libc++ 19 release notes [1], 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 causes graphics/libemf to fail to compile with clang 19 and libc++ 19, resulting in errors similar to: /usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 820 | static_assert(is_same<_CharT, typename traits_type::char_type>::value, | ^ libemf.cpp:982:30: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here 982 | std::basic_string<WCHAR> filename_w( filename, filename + filename_count ); | ^ /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here 23 | struct _LIBCPP_TEMPLATE_VIS char_traits; | ^ libemf should really use char16_t for its 16-bit character type, but the code is full of Windows assumptions that WCHAR is unsigned short. Since std::basic_string<unsigned short> is no longer available, use std::basic_string<char16_t> instead, and cast the result to the appropriate type for GetEnhMetaFileW(). [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals