The type_traits_test asserts `to_unsigned_t<char>` resolves to `unsigned char`, which only holds on platforms where `char` is signed (e.g. x86_64-linux). On platforms where `char` is unsigned by default (e.g. aarch64-linux), `to_unsigned_t<char>` resolves to `char`, and the static_assert fails to compile. Guard the assertion with `CHAR_MIN < 0` so the correct relationship is checked on each platform. Also drop `-Wno-character-conversion` from NIX_CFLAGS_COMPILE since GCC 15 does not recognize it (the build log shows it being reported as an unrecognized command-line option). Reported upstream: https://github.com/atcoder/ac-library/issues/191 ZHF: #516381
25 lines
826 B
Diff
25 lines
826 B
Diff
diff --git i/test/unittest/type_traits_test.cpp w/test/unittest/type_traits_test.cpp
|
|
index 164cc79..123b3a2 100644
|
|
--- i/test/unittest/type_traits_test.cpp
|
|
+++ w/test/unittest/type_traits_test.cpp
|
|
@@ -1,5 +1,6 @@
|
|
#include "atcoder/internal_type_traits"
|
|
|
|
+#include <climits>
|
|
#include <type_traits>
|
|
|
|
#include <gtest/gtest.h>
|
|
@@ -44,7 +45,12 @@ static_assert(internal::is_unsigned_int<unsigned long long>::value, "");
|
|
static_assert(!internal::is_signed_int<A>::value, "");
|
|
static_assert(!internal::is_unsigned_int<A>::value, "");
|
|
|
|
+#if CHAR_MIN < 0
|
|
static_assert(is_same<unsigned char, internal::to_unsigned_t<char>>::value, "");
|
|
+#else
|
|
+static_assert(is_same<char, internal::to_unsigned_t<char>>::value, "");
|
|
+#endif
|
|
+
|
|
static_assert(
|
|
is_same<unsigned char, internal::to_unsigned_t<signed char>>::value,
|
|
"");
|