From f05888692c9363550e2b4a1540541005f8410cff Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 23 Dec 2016 08:24:48 -0800 Subject: [PATCH] Fix handling of unpacked args (#437) --- fmt/format.h | 4 ++-- test/format-test.cc | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index 8a0623f4..6a58f338 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -1538,7 +1538,7 @@ template class format_arg_store { private: static const size_t NUM_ARGS = sizeof...(Args); - static const bool IS_PACKED = NUM_ARGS <= internal::MAX_PACKED_ARGS; + static const bool IS_PACKED = NUM_ARGS < internal::MAX_PACKED_ARGS; typedef typename Context::char_type char_type; @@ -1552,7 +1552,7 @@ class format_arg_store { static const uint64_t TYPES = internal::make_type(); format_arg_store(const Args &... args) - : data_{{internal::MakeValue(args)...}} {} + : data_{{internal::MakeArg(args)...}} {} const value_type *data() const { return data_.data(); } }; diff --git a/test/format-test.cc b/test/format-test.cc index d3d449a3..6829f622 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1577,10 +1577,11 @@ void print_error(const char *file, int line, const char *format, } #endif -TEST(FormatTest, MaxArgs) { - EXPECT_EQ("0123456789abcde", - fmt::format("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e')); +TEST(FormatTest, UnpackedArgs) { + EXPECT_EQ("0123456789abcdefg", + fmt::format("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', + 'f', 'g')); } #if FMT_USE_USER_DEFINED_LITERALS