mirror of
https://github.com/fmtlib/fmt.git
synced 2025-03-15 16:20:59 +00:00
Fix compile-time width/precision type check
This commit is contained in:
parent
8bd02e93b2
commit
7fb8d33f9d
@ -2948,7 +2948,10 @@ class format_string_checker {
|
|||||||
basic_string_view<Char> format_str, ErrorHandler eh)
|
basic_string_view<Char> format_str, ErrorHandler eh)
|
||||||
: context_(format_str, num_args, types_, eh),
|
: context_(format_str, num_args, types_, eh),
|
||||||
parse_funcs_{&parse_format_specs<Args, parse_context_type>...},
|
parse_funcs_{&parse_format_specs<Args, parse_context_type>...},
|
||||||
types_{type_constant<Args, char>::value...} {}
|
types_{
|
||||||
|
mapped_type_constant<Args,
|
||||||
|
basic_format_context<Char*, Char>>::value...} {
|
||||||
|
}
|
||||||
|
|
||||||
FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
|
FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
|
||||||
|
|
||||||
|
@ -895,6 +895,7 @@ TEST(format_test, runtime_width) {
|
|||||||
fmt::format("{0:{1}}", reinterpret_cast<void*>(0xcafe), 10));
|
fmt::format("{0:{1}}", reinterpret_cast<void*>(0xcafe), 10));
|
||||||
EXPECT_EQ("x ", fmt::format("{0:{1}}", 'x', 11));
|
EXPECT_EQ("x ", fmt::format("{0:{1}}", 'x', 11));
|
||||||
EXPECT_EQ("str ", fmt::format("{0:{1}}", "str", 12));
|
EXPECT_EQ("str ", fmt::format("{0:{1}}", "str", 12));
|
||||||
|
EXPECT_EQ(fmt::format("{:{}}", 42, short(4)), " 42");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(format_test, precision) {
|
TEST(format_test, precision) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user