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

### 3706. How does `std::format` work with character arrays of unknown bound?

Section: 22.14.6.3 [format.formatter.spec] Status: New Submitter: S. B. Tam Opened: 2022-05-31 Last modified: 2022-06-21

Priority: 3

View all other issues in [format.formatter.spec].

View all issues with New status.

Discussion:

Consider

>     #include <format>
>     #include <iostream>

>     extern char str[];
>     auto result = std::format("{}", str);
>     char str[] = "hello";

>     int main()
>     {
>       std::cout << result << std::endl;
>     }

Currently MSVC STL (as well as fmtlib when `fmt::format` is used instead of `std::format`) accepts the initializer of `result`, while libc++ produces an error (apparently because there's no `formatter` for `char[]`).

Should this be valid?

Daniel:

This issue is similar to LWG 3701, but not the same, because the latter wants `template<size_t N> struct formatter<charT[N], charT>`, while this one needs `template<>struct formatter<charT[], charT>` (that is, without the array bound).

[2022-06-21; Reflector poll]

Set priority to 3 after reflector poll.

Proposed resolution: