Skip to content

Implement LWG-3631 basic_format_arg(T&&) should use remove_cvref_t<T> throughout - #3745

Merged
Stephan T. Lavavej (StephanTLavavej) merged 3 commits into
microsoft:mainfrom
frederick-vs-ja:lwg-3631
Jun 15, 2023
Merged

Implement LWG-3631 basic_format_arg(T&&) should use remove_cvref_t<T> throughout #3745
Stephan T. Lavavej (StephanTLavavej) merged 3 commits into
microsoft:mainfrom
frederick-vs-ja:lwg-3631

Conversation

@frederick-vs-ja

@frederick-vs-ja A. Jiang (frederick-vs-ja) commented Jun 3, 2023

Copy link
Copy Markdown
Contributor

Also make formerly exposition only constructors private. As a result, several class templates are forward declared.

Add test coverage for construction of handle and inaccessibility of exposition only constructor(s). Note that construction of handle from a const rvalue is still possible since a const T rvalue can be bound to const T&.

Per S. B. Tam (@cpplearner)'s discovery on Discord, I decided to ensure that TQ (_Qual_for_handle<_Ty>_Tq in this PR) never drops const-qualifier from T (_Ty).

Fixes #3460.

Also make formerly exposition only constructors private.

Add test coverage for construction of `handle` and inaccessibility of exposition only constructor(s).
@frederick-vs-ja
A. Jiang (frederick-vs-ja) requested a review from a team as a code owner June 3, 2023 17:26

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes behavior pretty radically in the case of stuff that has conversions to one of the types supported "natively" by basic_format_arg, I actually like the change but just want to note that potentially breaking change. It's probably good though, since now such types can get formatted by their own formatter.

Requesting only the change to inline _Qual_for_handle

Comment thread stl/inc/format Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes behavior pretty radically in the case of stuff that has conversions to one of the types supported "natively" by basic_format_arg, I actually like the change but just want to note that potentially breaking change. It's probably good though, since now such types can get formatted by their own formatter.

Requesting only the change to inline _Qual_for_handle

Inlining `_Qual_for_handle`.
Comment thread stl/inc/format Outdated
Comment thread stl/inc/format Outdated
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks! FYI Charlie Barto (@barcharcraz) I pushed trivial changes after you approved.

@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit f68e64c into microsoft:main Jun 15, 2023
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for improving the usability of <format>! 😻 📝 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

format C++20/23 format LWG Library Working Group issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LWG-3631 basic_format_arg(T&&) should use remove_cvref_t<T> throughout

3 participants