A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue3706 below:

format work with character arrays of unknown bound?

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: 28.5.6.4 [format.formatter.spec] Status: New Submitter: S. B. Tam Opened: 2022-05-31 Last modified: 2022-06-21

Priority: 3

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

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(i), 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:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4