Skip to content

[libc++][format] String literals inside of tuple and pair should be escaped #59763

Closed
@JMazurkiewicz

Description

@JMazurkiewicz

Example:

#include <cstdio>
#include <format>
#include <tuple>
#include <string>
#include <string_view>
#include <utility>

using namespace std;

int main() {
    const tuple t{"_\t_", "_\t_"s};
    const pair p{auto{"_\t_"}, "_\t_"sv};
    puts(format("{}\n{}", t, p).c_str());
}

Expected output:

("_\t_", "_\t_")
("_\t_", "_\t_")

Got:

(_	_, "_\t_")
(_	_, "_\t_")

Compiler explorer: https://godbolt.org/z/8MnaMzzvo
Debug-enabled specializations: [format.formatter.spec]/2.2
Parsing format spec for tuple and pair: [format.tuple]/7

Metadata

Metadata

Assignees

Labels

confirmedVerified by a second partylibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions