mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-30 06:09:48 +01:00
Revert "Check dynamic widht/precision id at compile time (#1614)"
This reverts commit 7d748a6f82.
This commit is contained in:
@@ -2632,17 +2632,19 @@ class format_string_checker {
|
||||
explicit FMT_CONSTEXPR format_string_checker(
|
||||
basic_string_view<Char> format_str, ErrorHandler eh)
|
||||
: arg_id_(-1),
|
||||
context_(format_str, num_args, eh),
|
||||
context_(format_str, eh),
|
||||
parse_funcs_{&parse_format_specs<Args, parse_context_type>...} {}
|
||||
|
||||
FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
|
||||
|
||||
FMT_CONSTEXPR void on_arg_id() {
|
||||
arg_id_ = context_.next_arg_id();
|
||||
check_arg_id();
|
||||
}
|
||||
FMT_CONSTEXPR void on_arg_id(int id) {
|
||||
arg_id_ = id;
|
||||
context_.check_arg_id(id);
|
||||
check_arg_id();
|
||||
}
|
||||
FMT_CONSTEXPR void on_arg_id(basic_string_view<Char>) {
|
||||
on_error("compile-time checks don't support named arguments");
|
||||
@@ -2663,6 +2665,10 @@ class format_string_checker {
|
||||
using parse_context_type = basic_format_parse_context<Char, ErrorHandler>;
|
||||
enum { num_args = sizeof...(Args) };
|
||||
|
||||
FMT_CONSTEXPR void check_arg_id() {
|
||||
if (arg_id_ >= num_args) context_.on_error("argument not found");
|
||||
}
|
||||
|
||||
// Format specifier parsing function.
|
||||
using parse_func = const Char* (*)(parse_context_type&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user