Skip to content

Commit

Permalink
Added else branches to if constexpr statements to silence MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
matt77hias committed May 23, 2024
1 parent b817610 commit 0c30380
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -2709,8 +2709,10 @@ constexpr auto get_arg_index_by_name(basic_string_view<Char> name) -> int {
}
if constexpr (sizeof...(Args) > 0)
return get_arg_index_by_name<N + 1, Args...>(name);
(void)name; // Workaround an MSVC bug about "unused" parameter.
return -1;
else {
(void)name; // Workaround an MSVC bug about "unused" parameter.
return -1;
}
}
#endif

Expand All @@ -2719,9 +2721,14 @@ FMT_CONSTEXPR auto get_arg_index_by_name(basic_string_view<Char> name) -> int {
#if FMT_USE_NONTYPE_TEMPLATE_ARGS
if constexpr (sizeof...(Args) > 0)
return get_arg_index_by_name<0, Args...>(name);
#endif
else {
(void)name;
return -1;
}
#else
(void)name;
return -1;
#endif
}

template <typename Char, typename... Args> class format_string_checker {
Expand Down

0 comments on commit 0c30380

Please sign in to comment.