Fix formatting of abstract classes via ostream
This commit is contained in:
@@ -23,6 +23,7 @@ template <> struct formatter<test> : formatter<int> {
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "fmt/compile.h"
|
||||
#include "fmt/ostream.h"
|
||||
#include "fmt/ranges.h"
|
||||
#include "gmock/gmock.h"
|
||||
@@ -280,3 +281,15 @@ TEST(ostream_test, range) {
|
||||
auto strs = std::vector<test_string>{test_string("foo"), test_string("bar")};
|
||||
EXPECT_EQ("[foo, bar]", fmt::format("{}", strs));
|
||||
}
|
||||
|
||||
struct abstract {
|
||||
virtual ~abstract() = default;
|
||||
virtual void f() = 0;
|
||||
friend std::ostream& operator<<(std::ostream& os, const abstract&) {
|
||||
return os;
|
||||
}
|
||||
};
|
||||
|
||||
void format_abstract_compiles(const abstract& a) {
|
||||
fmt::format(FMT_COMPILE("{}"), a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user