Skip to content

Commit

Permalink
Fix BasicWriter::write without formatting arguments on C++11 (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Feb 16, 2015
1 parent 040b8e7 commit bd13338
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
6 changes: 6 additions & 0 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

1 comment on commit bd13338

@vitaut
Copy link
Contributor Author

@vitaut vitaut commented on bd13338 Feb 16, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/C++11/pre-C++11/
D'oh

Please sign in to comment.