Skip to content

Commit

Permalink
Fix broken condition
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Shchapov <[email protected]>
  • Loading branch information
phprus committed Oct 6, 2022
1 parent 491c32c commit 844fd7f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -777,22 +777,28 @@ FMT_END_DETAIL_NAMESPACE
template <typename Char, typename ErrorHandler>
FMT_CONSTEXPR void
basic_format_parse_context<Char, ErrorHandler>::do_check_arg_id(int id) {
detail::ignore_unused(id);
#if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 1200
// Argument id is only checked at compile-time during parsing because
// formatting has its own validation.
if (detail::is_constant_evaluated() && FMT_GCC_VERSION >= 1200) {
if (detail::is_constant_evaluated()) {
using context = detail::compile_parse_context<Char, ErrorHandler>;
if (id >= static_cast<context*>(this)->num_args())
on_error("argument not found");
}
#endif
}

template <typename Char, typename ErrorHandler>
FMT_CONSTEXPR void
basic_format_parse_context<Char, ErrorHandler>::check_dynamic_spec(int arg_id) {
if (detail::is_constant_evaluated() && FMT_GCC_VERSION >= 1200) {
detail::ignore_unused(arg_id);
#if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 1200
if (detail::is_constant_evaluated()) {
using context = detail::compile_parse_context<Char, ErrorHandler>;
static_cast<context*>(this)->check_dynamic_spec(arg_id);
}
#endif
}

template <typename Context> class basic_format_arg;
Expand Down

0 comments on commit 844fd7f

Please sign in to comment.