diff --git a/include/fmt/format.h b/include/fmt/format.h index a87d0eed..7f8d71f3 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2336,7 +2336,8 @@ class dynamic_specs_handler : : specs_setter(specs), specs_(specs), context_(ctx) {} constexpr dynamic_specs_handler(const dynamic_specs_handler &other) - : specs_setter(other), specs_(other.specs_), context_(other.context_) {} + : specs_setter(other), + specs_(other.specs_), context_(other.context_) {} template constexpr void on_dynamic_width(Id arg_id) { diff --git a/test/format-test.cc b/test/format-test.cc index 38bf2dd8..7d1e10d3 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1852,10 +1852,8 @@ constexpr bool equal(const char *s1, const char *s2) { template constexpr bool test_error(const char *fmt, const char *expected_error) { const char *actual_error = nullptr; - test_error_handler eh{actual_error}; - using ref = std::reference_wrapper; fmt::internal::check_format_string( - string_view(fmt, len(fmt)), eh); + string_view(fmt, len(fmt)), test_error_handler(actual_error)); return equal(actual_error, expected_error); } @@ -1866,7 +1864,10 @@ TEST(FormatTest, FormatStringErrors) { EXPECT_ERROR("foo", nullptr); EXPECT_ERROR("}", "unmatched '}' in format string"); EXPECT_ERROR("{0:s", "unknown format specifier", Date); +#ifndef _MSC_VER + // This causes an internal compiler error in MSVC2017. EXPECT_ERROR("{0:=5", "unknown format specifier", char); +#endif EXPECT_ERROR("{foo", "missing '}' in format string", int); EXPECT_ERROR("{10000000000}", "number is too big"); }