Title
format_parse_context::check_dynamic_spec should require at least one type
Status
voting
Section
[format.parse.ctx]
Submitter
Jonathan Wakely

Created on 2024-08-28.00:00:00 last changed yesterday

Messages

Date: 2024-09-18.22:28:16

Proposed resolution:

This wording is relative to N4988.

  1. Modify [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...`.

Date: 2024-09-15.00:00:00

[ 2024-09-18; Reflector poll ]

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

Date: 2024-08-28.00:00:00

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.

History
Date User Action Args
2024-11-19 16:09:07adminsetstatus: ready -> voting
2024-09-18 22:28:16adminsetmessages: + msg14382
2024-09-18 22:28:16adminsetstatus: new -> ready
2024-08-28 14:04:26adminsetmessages: + msg14344
2024-08-28 00:00:00admincreate