mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
FixedEnum -> StrongEnum and make it a regression test
This commit is contained in:
@ -825,7 +825,8 @@ template <typename Context> struct arg_mapper {
|
|||||||
FMT_ENABLE_IF(std::is_enum<T>::value &&
|
FMT_ENABLE_IF(std::is_enum<T>::value &&
|
||||||
!has_formatter<T, Context>::value &&
|
!has_formatter<T, Context>::value &&
|
||||||
!has_fallback_formatter<T, Context>::value)>
|
!has_fallback_formatter<T, Context>::value)>
|
||||||
FMT_CONSTEXPR auto map(const T& val) -> decltype(map(static_cast<typename std::underlying_type<T>::type>(val))) {
|
FMT_CONSTEXPR auto map(const T& val) -> decltype(
|
||||||
|
map(static_cast<typename std::underlying_type<T>::type>(val))) {
|
||||||
return map(static_cast<typename std::underlying_type<T>::type>(val));
|
return map(static_cast<typename std::underlying_type<T>::type>(val));
|
||||||
}
|
}
|
||||||
template <typename T,
|
template <typename T,
|
||||||
|
@ -1906,9 +1906,11 @@ TEST(FormatTest, FormatterNotSpecialized) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if FMT_HAS_FEATURE(cxx_strong_enums)
|
#if FMT_HAS_FEATURE(cxx_strong_enums)
|
||||||
enum TestFixedEnum : short { B = 1 };
|
enum big_enum : unsigned long long { big_enum_value = 5000000000ULL };
|
||||||
|
|
||||||
TEST(FormatTest, FixedEnum) { EXPECT_EQ("1", fmt::format("{}", B)); }
|
TEST(FormatTest, StrongEnum) {
|
||||||
|
EXPECT_EQ("5000000000", fmt::format("{}", big_enum_value));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using buffer_range = fmt::buffer_range<char>;
|
using buffer_range = fmt::buffer_range<char>;
|
||||||
|
Reference in New Issue
Block a user