mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 20:32:49 +00:00
Fix BasicWriter::write without formatting arguments on C++11 (#109)
This commit is contained in:
parent
040b8e7e06
commit
bd133382f0
1
format.h
1
format.h
@ -1355,6 +1355,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) {
|
|||||||
|
|
||||||
// Emulates a variadic function returning void on a pre-C++11 compiler.
|
// Emulates a variadic function returning void on a pre-C++11 compiler.
|
||||||
# define FMT_VARIADIC_VOID(func, arg_type) \
|
# define FMT_VARIADIC_VOID(func, arg_type) \
|
||||||
|
inline void func(arg_type arg) { func(arg, fmt::ArgList()); } \
|
||||||
FMT_WRAP1(func, arg_type, 1) FMT_WRAP1(func, arg_type, 2) \
|
FMT_WRAP1(func, arg_type, 1) FMT_WRAP1(func, arg_type, 2) \
|
||||||
FMT_WRAP1(func, arg_type, 3) FMT_WRAP1(func, arg_type, 4) \
|
FMT_WRAP1(func, arg_type, 3) FMT_WRAP1(func, arg_type, 4) \
|
||||||
FMT_WRAP1(func, arg_type, 5) FMT_WRAP1(func, arg_type, 6) \
|
FMT_WRAP1(func, arg_type, 5) FMT_WRAP1(func, arg_type, 6) \
|
||||||
|
@ -227,6 +227,12 @@ TEST(WriterTest, Data) {
|
|||||||
EXPECT_EQ("42", std::string(w.data(), w.size()));
|
EXPECT_EQ("42", std::string(w.data(), w.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(WriterTest, WriteWithoutArgs) {
|
||||||
|
MemoryWriter w;
|
||||||
|
w.write("test");
|
||||||
|
EXPECT_EQ("test", std::string(w.data(), w.size()));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(WriterTest, WriteInt) {
|
TEST(WriterTest, WriteInt) {
|
||||||
CHECK_WRITE(42);
|
CHECK_WRITE(42);
|
||||||
CHECK_WRITE(-42);
|
CHECK_WRITE(-42);
|
||||||
|
Loading…
Reference in New Issue
Block a user