From 811b0f90544353302b21a56bdceb984196155fa8 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 22 Apr 2020 10:50:07 -0700 Subject: [PATCH] Enable compile-time error tests --- include/fmt/core.h | 1 + test/format-test.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index d32e886d..a543f096 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1692,6 +1692,7 @@ struct named_arg : view, named_arg_base { : named_arg_base(name), value(val) {} }; +// Reports a compile-time error if S is not a valid format string. template ::value)> FMT_INLINE void check_format_string(const S&) { #ifdef FMT_ENFORCE_COMPILE_STRING diff --git a/test/format-test.cc b/test/format-test.cc index 7332a5ad..63dc4504 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -2470,7 +2470,7 @@ TEST(FormatTest, FormatStringErrors) { EXPECT_ERROR_NOARGS("foo", nullptr); EXPECT_ERROR_NOARGS("}", "unmatched '}' in format string"); EXPECT_ERROR("{0:s", "unknown format specifier", Date); -# if FMT_MSC_VER >= 1916 +# if !FMT_MSC_VER || FMT_MSC_VER >= 1916 // This causes an internal compiler error in MSVC2017. EXPECT_ERROR("{:{<}", "invalid fill character '{'", int); EXPECT_ERROR("{:10000000000}", "number is too big", int);