diff --git a/include/fmt/format.h b/include/fmt/format.h index bbc6fb42..0a251ce0 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3619,7 +3619,8 @@ FMT_END_NAMESPACE } \ } result; \ /* Suppress Qt Creator warning about unused operator. */ \ - (void)static_cast>(result); \ + (void)static_cast>( \ + result); \ return result; \ }() diff --git a/test/format-test.cc b/test/format-test.cc index 2e0ff199..fe149c53 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -2477,6 +2477,15 @@ TEST(FormatTest, VFormatTo) { #endif // FMT_USE_CONSTEXPR +template static std::string FmtToString(const T& t) { + return fmt::format(FMT_STRING("{}"), t); +} + +TEST(FormatTest, FmtStringInTemplate) { + EXPECT_EQ(FmtToString(1), "1"); + EXPECT_EQ(FmtToString(0), "0"); +} + TEST(FormatTest, ConstructU8StringViewFromCString) { fmt::u8string_view s("ab"); EXPECT_EQ(s.size(), 2u);