This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Fix LWG3146 "Excessive unwrapping in std::ref/cref"
ClosedPublic

Authored by Quuxplusone on Jan 22 2022, 9:20 AM.

Details

Summary

Drive-by constexprify some of the existing tests.

Diff Detail

Event Timeline

Quuxplusone requested review of this revision.Jan 22 2022, 9:20 AM
Quuxplusone created this revision.
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald TranscriptJan 22 2022, 9:20 AM
Quuxplusone retitled this revision from [libc++] [test] Fix LWG3146 "Excessive unwrapping in std::ref/cref" to [libc++] Fix LWG3146 "Excessive unwrapping in std::ref/cref".Jan 22 2022, 11:34 AM
philnik accepted this revision as: philnik.Jan 22 2022, 2:21 PM

LGTM % nits

libcxx/include/__functional/reference_wrapper.h
179

Pre-existing

libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp
39

I think I'd rather see // LWG 3146 here. Both tests are for the LWG issue.

Quuxplusone marked an inline comment as done.
Quuxplusone edited the summary of this revision. (Show Details)

Address review comments. Fix the C++03 test failure.
Comment on a hacky workaround in std::cref; I'll post a separate PR showing how we might remove it.

Mordante accepted this revision as: Mordante.Jan 23 2022, 4:28 AM

LGTM!

libcxx/include/__functional/reference_wrapper.h
213

That makes it clear it's supposed to work like this in all Standard modes and it's not a C++20 change.
Obviously this is kind of moot due to D117974.

libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp
25

Nice to see these constexpr tests!

ldionne accepted this revision.Jan 25 2022, 3:49 PM
This revision is now accepted and ready to land.Jan 25 2022, 3:49 PM