Skip to content

Commit

Permalink
Fix inconsistent type detection (#1662)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed May 9, 2020
1 parent 3a52c6a commit cfcafcc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1208,13 +1208,16 @@ FMT_CONSTEXPR basic_format_arg<Context> make_arg(const T& value) {
return arg;
}

template <bool IS_PACKED, typename Context, typename T,
// The type template parameter is there to avoid an ODR violation when using
// a fallback formatter in one translation unit and an implicit conversion in
// another (not recommended).
template <bool IS_PACKED, typename Context, type, typename T,
FMT_ENABLE_IF(IS_PACKED)>
inline value<Context> make_arg(const T& val) {
return arg_mapper<Context>().map(val);
}

template <bool IS_PACKED, typename Context, typename T,
template <bool IS_PACKED, typename Context, type, typename T,
FMT_ENABLE_IF(!IS_PACKED)>
inline basic_format_arg<Context> make_arg(const T& value) {
return make_arg<Context>(value);
Expand Down Expand Up @@ -1348,7 +1351,9 @@ class format_arg_store
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
basic_format_args<Context>(*this),
#endif
data_{internal::make_arg<is_packed, Context>(args)...} {
data_{internal::make_arg<
is_packed, Context,
internal::mapped_type_constant<Args, Context>::value>(args)...} {
}
};

Expand Down

0 comments on commit cfcafcc

Please sign in to comment.