error on bool arg w/ char pres_type (#3734)
This commit is contained in:
parent
5d55375a8a
commit
573d74395b
@ -2429,6 +2429,7 @@ FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(
|
||||
case 'G':
|
||||
return parse_presentation_type(pres::general_upper, float_set);
|
||||
case 'c':
|
||||
if (arg_type == type::bool_type) throw_format_error("invalid format specifier");
|
||||
return parse_presentation_type(pres::chr, integral_set);
|
||||
case 's':
|
||||
return parse_presentation_type(pres::string,
|
||||
|
@ -1159,6 +1159,8 @@ TEST(format_test, format_bool) {
|
||||
EXPECT_EQ("true", fmt::format("{:s}", true));
|
||||
EXPECT_EQ("false", fmt::format("{:s}", false));
|
||||
EXPECT_EQ("false ", fmt::format("{:6s}", false));
|
||||
EXPECT_THROW_MSG((void)fmt::format(runtime("{:c}"), false), format_error,
|
||||
"invalid format specifier");
|
||||
}
|
||||
|
||||
TEST(format_test, format_short) {
|
||||
|
Loading…
Reference in New Issue
Block a user