The std::basic_string template specialization for int16_t was deprecated in libcxx 18 and removed in libcxx 19, which broke compilation of the iconv test:
FAILED: tests/gtest-main.p/tests_iconv.cpp.o
clang++ -Itests/gtest-main.p -Itests -I../tests -I../tests/support -I../libaegisub/include -I/nix/store/wa87rn29fm9crmp20n976b1cl2b3r5cd-vapoursynth-70/include/vapoursynth -I/nix/store
/7x766s543q8zsgbnqgpnl90a3bs7c508-gtest-1.15.2-dev/include -I/nix/store/b2az10j09qfkbkr98nqp3z330dqqgal1-boost-1.86.0-dev/include -fdiagnostics-color=always -D_LIBCPP_HARDENING_MODE=_L
IBCPP_HARDENING_MODE_FAST -Wall -Winvalid-pch -std=c++17 -DGL_SILENCE_DEPRECATION -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREA
D_USE_LIB=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_ALL_NO_LIB -DGTEST_HAS_PTHREAD=1 -MD -MQ tests/gtest-main.p/tests_iconv.cpp.o -MF tests/gtest-main.p/tests_iconv.cpp.o.d -o tests/gtest
-main.p/tests_iconv.cpp.o -c ../tests/tests/iconv.cpp
In file included from ../tests/tests/iconv.cpp:15:
In file included from ../libaegisub/include/libaegisub/charset_conv.h:22:
/nix/store/r3wiygrch2ynqxd8ky7hlb7wdw939cxr-libcxx-19.1.5-dev/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<short>'
820 | static_assert(is_same<_CharT, typename traits_type::char_type>::value,
| ^
../tests/tests/iconv.cpp:45:30: note: in instantiation of template class 'std::basic_string<short>' requested here
45 | std::basic_string<int16_t> str(i, ' ');
| ^
/nix/store/r3wiygrch2ynqxd8ky7hlb7wdw939cxr-libcxx-19.1.5-dev/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
| ^
I worked around this by using char16_t and char32_t (std::u16string and std::u32string also work):
diff --git a/tests/tests/iconv.cpp b/tests/tests/iconv.cpp
index 91d512b1b..919f6facf 100644
--- a/tests/tests/iconv.cpp
+++ b/tests/tests/iconv.cpp
@@ -42,7 +42,8 @@ TEST(lagi_iconv, StrLen1) {
TEST(lagi_iconv, StrLen2) {
IconvWrapper conv("UTF-16LE", "UTF-16LE", false);
for (int i = 0; i < 10; i++) {
- std::basic_string<int16_t> str(i, ' ');
+ std::basic_string<char16_t> str(i, ' ');
+ static_assert(sizeof(char16_t) == sizeof(int16_t));
ASSERT_EQ(2*i, conv.SrcStrLen((const char *)str.c_str()));
ASSERT_EQ(2*i, conv.DstStrLen((const char *)str.c_str()));
}
@@ -50,7 +51,8 @@ TEST(lagi_iconv, StrLen2) {
TEST(lagi_iconv, StrLen4) {
IconvWrapper conv("UTF-32LE", "UTF-32LE", false);
for (int i = 0; i < 10; i++) {
- std::basic_string<int32_t> str(i, ' ');
+ std::basic_string<char32_t> str(i, ' ');
+ static_assert(sizeof(char32_t) == sizeof(int32_t));
ASSERT_EQ(4*i, conv.SrcStrLen((const char *)str.c_str()));
ASSERT_EQ(4*i, conv.DstStrLen((const char *)str.c_str()));
}
The standard defines char16_t and char32_t to be at least (but not exactly) 16 or 32 bits, which is why I added the static_assert.
The
std::basic_stringtemplate specialization forint16_twas deprecated in libcxx 18 and removed in libcxx 19, which broke compilation of the iconv test:I worked around this by using
char16_tandchar32_t(std::u16stringandstd::u32stringalso work):The standard defines
char16_tandchar32_tto be at least (but not exactly) 16 or 32 bits, which is why I added thestatic_assert.