diff --git a/include/fmt/core.h b/include/fmt/core.h index 467fdb86..13a0edf2 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -2948,7 +2948,10 @@ class format_string_checker { basic_string_view format_str, ErrorHandler eh) : context_(format_str, num_args, types_, eh), parse_funcs_{&parse_format_specs...}, - types_{type_constant::value...} {} + types_{ + mapped_type_constant>::value...} { + } FMT_CONSTEXPR void on_text(const Char*, const Char*) {} diff --git a/test/format-test.cc b/test/format-test.cc index 5d8f19f3..f3bdb464 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -895,6 +895,7 @@ TEST(format_test, runtime_width) { fmt::format("{0:{1}}", reinterpret_cast(0xcafe), 10)); EXPECT_EQ("x ", fmt::format("{0:{1}}", 'x', 11)); EXPECT_EQ("str ", fmt::format("{0:{1}}", "str", 12)); + EXPECT_EQ(fmt::format("{:{}}", 42, short(4)), " 42"); } TEST(format_test, precision) {