Skip to content

Commit

Permalink
Fix compilation error if PACKED is defined before including FMT
Browse files Browse the repository at this point in the history
Reduces the chance of conflicts between a macro declaration and the template argument name by using CamelCase (`PACKED` -> `IsPacked`)

Fixes fmtlib#3632
  • Loading branch information
glebm authored Sep 11, 2023
1 parent d498754 commit ade36e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ constexpr auto encode_types() -> unsigned long long {
template <typename T, typename Char> struct type_is_unformattable_for;
#endif

template <bool PACKED, typename Context, typename T, FMT_ENABLE_IF(PACKED)>
template <bool IsPacked, typename Context, typename T, FMT_ENABLE_IF(IsPacked)>
FMT_CONSTEXPR FMT_INLINE auto make_arg(T& val) -> value<Context> {
using arg_type = remove_cvref_t<decltype(arg_mapper<Context>().map(val))>;

Expand Down Expand Up @@ -1591,7 +1591,7 @@ FMT_CONSTEXPR auto make_arg(T& val) -> basic_format_arg<Context> {
return arg;
}

template <bool PACKED, typename Context, typename T, FMT_ENABLE_IF(!PACKED)>
template <bool IsPacked, typename Context, typename T, FMT_ENABLE_IF(!IsPacked)>
FMT_CONSTEXPR inline auto make_arg(T& val) -> basic_format_arg<Context> {
return make_arg<Context>(val);
}
Expand Down

0 comments on commit ade36e0

Please sign in to comment.