Adjust unit test to require __cpp_lib_bit_cast
This commit is contained in:
parent
4a8a038144
commit
003ccb4271
@ -297,8 +297,6 @@ template <typename To, typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))>
|
||||
FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To {
|
||||
#ifdef __cpp_lib_bit_cast
|
||||
if (is_constant_evaluated()) return std::bit_cast<To>(from);
|
||||
#elif FMT_HAS_BUILTIN(__builtin_bit_cast)
|
||||
return __builtin_bit_cast(To, from);
|
||||
#endif
|
||||
auto to = To();
|
||||
// The cast suppresses a bogus -Wclass-memaccess on GCC.
|
||||
|
||||
@ -228,9 +228,15 @@ TEST(compile_test, format_to_n) {
|
||||
}
|
||||
|
||||
TEST(compile_test, formatted_size) {
|
||||
FMT_CONSTEXPR20 size_t s1 = fmt::formatted_size(FMT_COMPILE("{0}"), 42);
|
||||
#ifdef __cpp_lib_bit_cast
|
||||
FMT_CONSTEXPR20
|
||||
#endif
|
||||
size_t s1 = fmt::formatted_size(FMT_COMPILE("{0}"), 42);
|
||||
EXPECT_EQ(2, s1);
|
||||
FMT_CONSTEXPR20 size_t s2 = fmt::formatted_size(FMT_COMPILE("{0:<4.2f}"), 42.0);
|
||||
#ifdef __cpp_lib_bit_cast
|
||||
FMT_CONSTEXPR20
|
||||
#endif
|
||||
size_t s2 = fmt::formatted_size(FMT_COMPILE("{0:<4.2f}"), 42.0);
|
||||
EXPECT_EQ(5, s2);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user