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..1b5a2f71 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -2475,6 +2475,15 @@ TEST(FormatTest, VFormatTo) { EXPECT_EQ(L"42", w); } +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"); +} + #endif // FMT_USE_CONSTEXPR TEST(FormatTest, ConstructU8StringViewFromCString) {