C++ Logo

std-discussion

Advanced search

Is basic_format_parse_context::check_arg_id underspecified?

From: Mark de Wever <koraq_at_[hidden]>
Date: Fri, 27 Nov 2020 09:20:09 +0100
Hi,

I'm looking at basic_format_parse_context::check_arg_id's specification
(eel.is/c++draft/format.parse.ctx)
    constexpr void check_arg_id(size_t id);

    Effects: If indexing_ != automatic, equivalent to: if
    (indexing_ == unknown) indexing_ = manual;

    Throws: format_error if indexing_ == automatic which indicates
    mixing of automatic and manual argument indexing.

    Remarks: Call expressions where id >= num_args_ are not core
    constant expressions ([expr.const]).

I'm wondering whether the remark means that the function throws a
format_error exception when id >= num_args_. Or should the text be
modified to something like:
    Throws: format_error if indexing_ == automatic which indicates
    mixing of automatic and manual argument indexing. format_error if
    id >= num_args_ which indicates evaluating a non-existing argument.

If this is considered an issue I'll file a LWG issue.

Note the issue was already present in the original paper
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0645r10.html#check_arg_id-def

Kind regard,
Mark de Wever

Received on 2020-11-27 02:20:18