This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Tentatively Ready status.

4142. format_parse_context::check_dynamic_spec should require at least one type

Section: 28.5.6.6 [format.parse.ctx] Status: Tentatively Ready Submitter: Jonathan Wakely Opened: 2024-08-28 Last modified: 2024-09-18

Priority: Not Prioritized

View all other issues in [format.parse.ctx].

View all issues with Tentatively Ready status.

Discussion:

The Mandates: conditions for format_parse_context::check_dynamic_spec are:

-14- Mandates: The types in Ts... are unique. Each type in Ts... is one of bool, char_type, int, unsigned int, long long int, unsigned long long int, float, double, long double, const char_type*, basic_string_view<char_type>, or const void*.

There seems to be no reason to allow Ts to be an empty pack, that's not useful. There is no valid arg-id value that can be passed to it if the list of types is empty, since arg(n) will never be one of the types in an empty pack. So it's never a constant expression if the pack is empty.

[2024-09-18; Reflector poll]

Set status to Tentatively Ready after seven votes in favour during reflector poll.

Proposed resolution:

This wording is relative to N4988.

  1. Modify 28.5.6.6 [format.parse.ctx] as indicated:

    template<class... Ts>
      constexpr void check_dynamic_spec(size_t id) noexcept;
    

    -14- Mandates: sizeof...(Ts) ≥ 1. The types in Ts... are unique. Each type in Ts... is one of bool, char_type, int, unsigned int, long long int, unsigned long long int, float, double, long double, const char_type*, basic_string_view<char_type>, or const void*.

    -15- Remarks: A call to this function is a core constant expression only if:

    1. (15.1) — id < num_args_ is true and
    2. (15.2) — the type of the corresponding format argument (after conversion to basic_format_arg<Context>) is one of the types in Ts....