This is an archive of the discontinued LLVM Phabricator instance.

[libc++][format] Adds formattable-with concept.
ClosedPublic

Authored by Mordante on Jun 4 2023, 2:28 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rG48abcf11ada1: [libc++][format] Adds formattable-with concept.
Summary

This change has a few additional effects:

  • Abstract classes are now formattable.
  • Volatile objects are no longer formattable.

Implements

  • LWG3631 basic_format_arg(T&&) should use remove_cvref_t<T> throughout
  • LWG3925 Concept formattable's definition is incorrect

Diff Detail

Event Timeline

Mordante created this revision.Jun 4 2023, 2:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2023, 2:28 AM
Mordante requested review of this revision.Jun 4 2023, 2:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2023, 2:28 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante updated this revision to Diff 532676.Jun 19 2023, 8:31 AM

Rebased.
LWG3925 has been accepted in Varna, adjust the state accordingly.

Mordante edited the summary of this revision. (Show Details)Jun 19 2023, 8:31 AM
ldionne accepted this revision.Jun 20 2023, 8:55 AM
ldionne added a subscriber: ldionne.

LGTM w/ nitpicks.

libcxx/docs/Status/Cxx2cIssues.csv
14
libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp
55

Would it make sense to add a test for !std::formattable<volatile T&, CharT>. I guess you could do assert_is_no_formattable<volatile int, CharT>() -- I think something like that would do the trick. And in the place where you make this call you can say // https://wg21.link/LWGXXXXXX to justify it.

This revision is now accepted and ready to land.Jun 20 2023, 8:55 AM
Mordante updated this revision to Diff 532990.Jun 20 2023, 10:48 AM
Mordante marked an inline comment as done.

Rebased and addresses review comments.

Mordante marked an inline comment as done.Jun 20 2023, 10:49 AM
This revision was automatically updated to reflect the committed changes.