Date
2022-05-17.00:00:00
Message id
12473

Content

The wording in [format.functions]/20 and [format.functions]/25 both contain

formatter<remove_cvref_t<Ti>, charT> meets the BasicFormatter requirements ([formatter.requirements]) for each Ti in Args.

The issue is that remove_cvref_t<const charT[N]> becomes charT[N]. [format.formatter.spec]/2.2 requires a specialization for

template<size_t N> struct formatter<const charT[N], charT>;

but there's no requirement to provide

 template<size_t N> struct formatter<charT[N], charT>;

There's no wording preventing library vendors from providing additional specializations. So it's possible to implement the current specification but the indirect requirement is odd. I noticed this while implementing a formattable concept. The concept is based on the formattable concept of P2286 "Formatting Ranges" (This paper is targeting C++23.)

It could be argued that the specialization

template<size_t N> struct formatter<const charT[N], charT>

is not needed and should be removed from the Standard. This will be an API break. Vendors can decide to keep the no longer required specialization as an extension; which would lead to implementation divergence. Microsoft is already shipping this specialization as stable and Victor doesn't like the removal too.

Therefore I only propose to add the required formatter specialization.