Fix handling of types with deleted rvalue conversion to string (#1421)

This commit is contained in:
Victor Zverovich
2019-11-25 08:30:47 -08:00
parent 57cd3f72e9
commit 99b6e928d4
2 changed files with 12 additions and 1 deletions

View File

@@ -649,3 +649,14 @@ TEST(FormatterTest, FormatExplicitlyConvertibleToStringLike) {
EXPECT_EQ("foo", fmt::format("{}", explicitly_convertible_to_string_like()));
}
#endif
struct disabled_rvalue_conversion {
operator const char*() const& { return "foo"; }
operator const char*()& { return "foo"; }
operator const char*() const&& = delete;
operator const char*()&& = delete;
};
TEST(FormatterTest, DisabledRValueConversion) {
EXPECT_EQ("foo", fmt::format("{}", disabled_rvalue_conversion()));
}