mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 11:17:35 +02:00
Fix handling of long with FMT_BUILTIN_TYPES=0
This commit is contained in:
@ -239,7 +239,7 @@
|
|||||||
FMT_PRAGMA_GCC(push_options)
|
FMT_PRAGMA_GCC(push_options)
|
||||||
#if !defined(__OPTIMIZE__) && !defined(__CUDACC__) && !defined(FMT_MODULE)
|
#if !defined(__OPTIMIZE__) && !defined(__CUDACC__) && !defined(FMT_MODULE)
|
||||||
FMT_PRAGMA_GCC(optimize("Og"))
|
FMT_PRAGMA_GCC(optimize("Og"))
|
||||||
#define FMT_GCC_OPTIMIZED
|
# define FMT_GCC_OPTIMIZED
|
||||||
#endif
|
#endif
|
||||||
FMT_PRAGMA_CLANG(diagnostic push)
|
FMT_PRAGMA_CLANG(diagnostic push)
|
||||||
|
|
||||||
@ -1102,7 +1102,7 @@ FMT_CONSTEXPR void init_static_named_arg(named_arg_info<Char>* named_args,
|
|||||||
|
|
||||||
// To minimize the number of types we need to deal with, long is translated
|
// To minimize the number of types we need to deal with, long is translated
|
||||||
// either to int or to long long depending on its size.
|
// either to int or to long long depending on its size.
|
||||||
enum { long_short = sizeof(long) == sizeof(int) };
|
enum { long_short = sizeof(long) == sizeof(int) && FMT_BUILTIN_TYPES };
|
||||||
using long_type = conditional_t<long_short, int, long long>;
|
using long_type = conditional_t<long_short, int, long long>;
|
||||||
using ulong_type = conditional_t<long_short, unsigned, unsigned long long>;
|
using ulong_type = conditional_t<long_short, unsigned, unsigned long long>;
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
TEST(no_builtin_types_test, format) {
|
TEST(no_builtin_types_test, format) {
|
||||||
EXPECT_EQ(fmt::format("{}", 42), "42");
|
EXPECT_EQ(fmt::format("{}", 42), "42");
|
||||||
|
EXPECT_EQ(fmt::format("{}", 42L), "42");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(no_builtin_types_test, double_is_custom_type) {
|
TEST(no_builtin_types_test, double_is_custom_type) {
|
||||||
|
Reference in New Issue
Block a user