format_parse_context::check_dynamic_spec should require at least one typeSection: 28.5.6.6 [format.parse.ctx] Status: WP Submitter: Jonathan Wakely Opened: 2024-08-28 Last modified: 2024-11-28
Priority: Not Prioritized
View all other issues in [format.parse.ctx].
View all issues with WP status.
Discussion:
The Mandates: conditions for format_parse_context::check_dynamic_spec
are:
-14- Mandates: The types inTs...are unique. Each type inTs...is one ofbool,char_type,int,unsigned int,long long int,unsigned long long int,float,double,long double,const char_type*,basic_string_view<char_type>, orconst 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.
[Wrocław 2024-11-23; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4988.
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 inTs...are unique. Each type inTs...is one ofbool,char_type,int,unsigned int,long long int,unsigned long long int,float,double,long double,const char_type*,basic_string_view<char_type>, orconst void*.-15- Remarks: A call to this function is a core constant expression only if:
- (15.1) —
id < num_args_istrueand- (15.2) — the type of the corresponding format argument (after conversion to
basic_format_arg<Context>) is one of the types inTs....