This is an archive of the discontinued LLVM Phabricator instance.

[libc++][format] Addresses LWG3720.
ClosedPublic

Authored by Mordante on Feb 18 2023, 3:48 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rGd85165184300: [libc++][format] Addresses LWG3720.
Summary
LWG3720 Restrict the valid types of arg-id for width and precision in
std-format-spec

Depends on D144325

Diff Detail

Event Timeline

Mordante created this revision.Feb 18 2023, 3:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2023, 3:48 AM
Mordante requested review of this revision.Feb 18 2023, 3:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2023, 3:48 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante updated this revision to Diff 498576.Feb 18 2023, 4:32 AM

CI fixes.

Mordante updated this revision to Diff 498587.Feb 18 2023, 6:28 AM

CI fixes.

ldionne added inline comments.
libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.verify.cpp
32

Do we get some sort of note that explains the reason for the format failing to parse?

Mordante marked an inline comment as done.Mar 14 2023, 10:27 AM
Mordante added inline comments.
libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.verify.cpp
32

Unfortunately no. I know it can be done with template magic, but that seems non-trivial to do. I have considered adding a way to get better compile time errors in Clang. There is a recent paper by Barry (P2758) which proposes something like that, but even more powerful than I originally considered.

ldionne accepted this revision.Mar 28 2023, 8:49 AM
ldionne added inline comments.
libcxx/include/__format/parser_std_format_spec.h
94–96
This revision is now accepted and ready to land.Mar 28 2023, 8:49 AM
ldionne added inline comments.Mar 28 2023, 9:01 AM
libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp
12–14

I think you want to remove these annotations, and if the back-deployment CI fails, then you must be using floating-point to_chars, so you can add:

// XFAIL: availability-fp_to_chars-missing
Mordante updated this revision to Diff 511903.Apr 8 2023, 10:00 AM
Mordante marked 3 inline comments as done.

Rebased, addresses review comments, and test the CI.

This revision was landed with ongoing or failed builds.Apr 9 2023, 3:50 AM
This revision was automatically updated to reflect the committed changes.