This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.
id
check in basic_format_parse_context::next_arg_id
Section: 28.5.6.6 [format.parse.ctx] Status: C++23 Submitter: Victor Zverovich Opened: 2022-11-09 Last modified: 2023-11-22
Priority: Not Prioritized
View all other issues in [format.parse.ctx].
View all issues with C++23 status.
Discussion:
The definition of check_arg_id
in 28.5.6.6 [format.parse.ctx] includes a (compile-time)
argument id
check in the Remarks element:
constexpr void check_arg_id(size_t id);[…]
Remarks: Call expressions whereid >= num_args_
are not core constant expressions (7.7 [expr.const]).
However, a similar check is missing from next_arg_id
which means that there is no argument id validation
in user-defined format specification parsing code that invokes this function (e.g. when parsing automatically
indexed dynamic width).
Previous resolution [SUPERSEDED]:
This wording is relative to N4917.
Modify 28.5.6.6 [format.parse.ctx] as indicated:
constexpr size_t next_arg_id();-7- Effects: If
indexing_ != manual
, equivalent to:if (indexing_ == unknown) indexing_ = automatic; return next_arg_id_++;-8- Throws:
-?- Remarks: Call expressions whereformat_error
ifindexing_ == manual
which indicates mixing of automatic and manual argument indexing.next_arg_id_ >= num_args_
are not core constant expressions (7.7 [expr.const]).
[2022-11-11; Tomasz provide improved wording; Move to Open]
Clarify that the value of next_arg_id_
is used, and add missing "is true
."
[Kona 2022-11-11; move to Ready]
[2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4917.
Modify 28.5.6.6 [format.parse.ctx] as indicated:
constexpr size_t next_arg_id();-7- Effects: If
indexing_ != manual
istrue
, equivalent to:if (indexing_ == unknown) indexing_ = automatic; return next_arg_id_++;-8- Throws:
-?- Remarks: Let cur-arg-id be the value offormat_error
ifindexing_ == manual
istrue
which indicates mixing of automatic and manual argument indexing.next_arg_id_
prior to this call. Call expressions wherecur-arg-id >= num_args_
istrue
are not core constant expressions (7.7 [expr.const]).
constexpr size_t check_arg_id(size_t id);-9- Effects: If
indexing_ != automatic
istrue
, equivalent to:if (indexing_ == unknown) indexing_ = manual;-10- Throws:
-11- Remarks: Call expressions whereformat_error
ifindexing_ == automatic
istrue
which indicates mixing of automatic and manual argument indexing.id >= num_args_
istrue
are not core constant expressions (7.7 [expr.const]).