diff --git a/fmt/format.h b/fmt/format.h index f102c219..ef7a1ab5 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -1098,7 +1098,7 @@ struct CustomValue { }; // A formatting argument value. -template +template struct Value { union { int int_value; @@ -1111,8 +1111,8 @@ struct Value { StringValue string; StringValue sstring; StringValue ustring; - StringValue tstring; - CustomValue custom; + StringValue tstring; + CustomValue custom; }; }; @@ -1177,7 +1177,7 @@ constexpr Type type() { return gettype::type>(); } // Makes a format_arg object from any type. template -class MakeValue : public Value { +class MakeValue : public Value { public: typedef typename Context::char_type Char; @@ -1347,7 +1347,7 @@ class basic_format_args; template class basic_format_arg { private: - internal::Value value_; + internal::Value value_; internal::Type type_; template @@ -1514,8 +1514,7 @@ constexpr uint64_t make_type() { return 0; } enum { MAX_PACKED_ARGS = 16 }; template -inline typename std::enable_if< - IS_PACKED, Value>::type +inline typename std::enable_if>::type make_arg(const T& value) { return MakeValue(value); } @@ -1538,7 +1537,7 @@ class format_arg_store { typedef typename Context::char_type char_type; typedef typename std::conditional, basic_format_arg>::type value_type; + internal::Value, basic_format_arg>::type value_type; // If the arguments are not packed, add one more element to mark the end. typedef std::array Array; @@ -1582,7 +1581,7 @@ class basic_format_args { // This is done to reduce compiled code size as storing larger objects // may require more code (at least on x86-64) even if the same amount of // data is actually copied to stack. It saves ~10% on the bloat test. - const internal::Value *values_; + const internal::Value *values_; const format_arg *args_; }; @@ -1595,7 +1594,7 @@ class basic_format_args { friend class internal::ArgMap; - void set_data(const internal::Value *values) { values_ = values; } + void set_data(const internal::Value *values) { values_ = values; } void set_data(const format_arg *args) { args_ = args; } format_arg get(size_type index) const { @@ -1603,7 +1602,7 @@ class basic_format_args { bool use_values = type(internal::MAX_PACKED_ARGS - 1) == internal::NONE; if (index < internal::MAX_PACKED_ARGS) { typename internal::Type arg_type = type(index); - internal::Value &val = arg.value_; + internal::Value &val = arg.value_; if (arg_type != internal::NONE) val = use_values ? values_[index] : args_[index].value_; arg.type_ = arg_type; diff --git a/test/util-test.cc b/test/util-test.cc index 73d3ca8a..2c0dc448 100644 --- a/test/util-test.cc +++ b/test/util-test.cc @@ -412,19 +412,20 @@ TEST(UtilTest, FormatArgs) { EXPECT_FALSE(args[1]); } -struct CustomFormatter { +struct CustomContext { typedef char char_type; bool called; }; -void format_value(fmt::Writer &, const Test &, CustomFormatter &ctx) { +void format_value(fmt::Writer &, const Test &, CustomContext &ctx) { ctx.called = true; } TEST(UtilTest, MakeValueWithCustomFormatter) { ::Test t; - fmt::internal::Value arg = fmt::internal::MakeValue(t); - CustomFormatter ctx = {false}; + fmt::internal::Value arg = + fmt::internal::MakeValue(t); + CustomContext ctx = {false}; fmt::MemoryWriter w; arg.custom.format(w, &t, &ctx); EXPECT_TRUE(ctx.called);