From bd133382f0e12a9c024547d4257e7a559cc3e9ec Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 16 Feb 2015 14:32:38 -0800 Subject: [PATCH] Fix BasicWriter::write without formatting arguments on C++11 (#109) --- format.h | 1 + test/format-test.cc | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/format.h b/format.h index 52e8d5b3..db7c0cf4 100644 --- a/format.h +++ b/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. # 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, 3) FMT_WRAP1(func, arg_type, 4) \ FMT_WRAP1(func, arg_type, 5) FMT_WRAP1(func, arg_type, 6) \ diff --git a/test/format-test.cc b/test/format-test.cc index 37c519ad..151411fc 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -227,6 +227,12 @@ TEST(WriterTest, Data) { 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) { CHECK_WRITE(42); CHECK_WRITE(-42);