Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing typename to FMT_STRING. #1089

Merged
merged 2 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -3619,7 +3619,8 @@ FMT_END_NAMESPACE
} \
} result; \
/* Suppress Qt Creator warning about unused operator. */ \
(void)static_cast<fmt::basic_string_view<str::char_type>>(result); \
(void)static_cast<fmt::basic_string_view<typename str::char_type>>( \
result); \
return result; \
}()

Expand Down
9 changes: 9 additions & 0 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2475,6 +2475,15 @@ TEST(FormatTest, VFormatTo) {
EXPECT_EQ(L"42", w);
}

template <typename T> 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) {
Expand Down