mirror of
https://github.com/fmtlib/fmt.git
synced 2025-03-30 13:20:18 +00:00
Include 128-bit with other signed integers in specifier check
This commit is contained in:
parent
70de324aa8
commit
6a13464059
@ -2819,7 +2819,8 @@ template <typename Handler> class specs_checker : public Handler {
|
|||||||
FMT_CONSTEXPR void on_sign(sign_t s) {
|
FMT_CONSTEXPR void on_sign(sign_t s) {
|
||||||
require_numeric_argument();
|
require_numeric_argument();
|
||||||
if (is_integral_type(arg_type_) && arg_type_ != type::int_type &&
|
if (is_integral_type(arg_type_) && arg_type_ != type::int_type &&
|
||||||
arg_type_ != type::long_long_type && arg_type_ != type::char_type) {
|
arg_type_ != type::long_long_type && arg_type_ != type::int128_type &&
|
||||||
|
arg_type_ != type::char_type) {
|
||||||
this->on_error("format specifier requires signed argument");
|
this->on_error("format specifier requires signed argument");
|
||||||
}
|
}
|
||||||
Handler::on_sign(s);
|
Handler::on_sign(s);
|
||||||
|
@ -570,6 +570,9 @@ TEST(format_test, plus_sign) {
|
|||||||
EXPECT_THROW_MSG((void)fmt::format(runtime("{0:+}"), 42ul), format_error,
|
EXPECT_THROW_MSG((void)fmt::format(runtime("{0:+}"), 42ul), format_error,
|
||||||
"format specifier requires signed argument");
|
"format specifier requires signed argument");
|
||||||
EXPECT_EQ("+42", fmt::format("{0:+}", 42ll));
|
EXPECT_EQ("+42", fmt::format("{0:+}", 42ll));
|
||||||
|
#if FMT_USE_INT128
|
||||||
|
EXPECT_EQ("+42", fmt::format("{0:+}", __int128_t(42)));
|
||||||
|
#endif
|
||||||
EXPECT_THROW_MSG((void)fmt::format(runtime("{0:+}"), 42ull), format_error,
|
EXPECT_THROW_MSG((void)fmt::format(runtime("{0:+}"), 42ull), format_error,
|
||||||
"format specifier requires signed argument");
|
"format specifier requires signed argument");
|
||||||
EXPECT_EQ("+42", fmt::format("{0:+}", 42.0));
|
EXPECT_EQ("+42", fmt::format("{0:+}", 42.0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user