Fix handling of types convertible to int

This commit is contained in:
Victor Zverovich
2017-09-02 07:08:19 -07:00
parent 89654cd127
commit 3e75d3e001
3 changed files with 27 additions and 10 deletions
+15
View File
@@ -172,3 +172,18 @@ TEST(OStreamTest, WriteToOStreamMaxSize) {
} while (size != 0);
fmt::internal::write(os, w);
}
struct ConvertibleToInt {
template <typename ValueType>
operator ValueType() const {
return 0;
}
friend std::ostream &operator<<(std::ostream &o, ConvertibleToInt) {
return o << "foo";
}
};
TEST(FormatTest, FormatConvertibleToInt) {
EXPECT_EQ("foo", fmt::format("{}", ConvertibleToInt()));
}