This is an archive of the discontinued LLVM Phabricator instance.

[libc++] add test for latch ctor
ClosedPublic

Authored by diamante0018 on Jul 11 2023, 6:05 AM.

Details

Reviewers
philnik
Group Reviewers
Restricted Project
Commits
rGdd2cfabddb6d: [libc++] add test for latch ctor
Summary

Currently, there are no tests to confirm without a doubt the constructor of latch is really constexpr and explicit.
I think this would be an addition that it would not harm to have. In another revision, I was asked to add tests for an almost identical case which made me consider adding this test for the latch class too.

Diff Detail

Event Timeline

diamante0018 created this revision.Jul 11 2023, 6:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 6:05 AM
diamante0018 requested review of this revision.Jul 11 2023, 6:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 6:05 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Use (void) instead of maybe unused (requires c++17)

'static_assert' with no message is a C++17 extension

philnik accepted this revision.Jul 11 2023, 2:42 PM
philnik added a subscriber: philnik.

Thanks! LGTM with green CI and the static_assert fixed.

libcxx/test/std/thread/thread.latch/ctor.pass.cpp
25

You're missing an argument here.

just thoughts, not an action item for you
Maybe we should add a new test trait is_explicit which is an error if there is no constructor which matches, true if it's not convertible and false if it is. That would catch these kinds of errors.

This revision is now accepted and ready to land.Jul 11 2023, 2:42 PM

Address review comments - Add second argument to test_convertible

diamante0018 marked an inline comment as done.Jul 11 2023, 2:48 PM

Thanks for having a look.
Since I don't have commit access, here are my details for when CI turns green.

Edoardo Sanguineti <edoardo.sanguineti222@gmail.com>

Remove xfail flag which probably is the culprit making the test fail on two Mac runners

This revision was landed with ongoing or failed builds.Jul 12 2023, 12:33 PM
This revision was automatically updated to reflect the committed changes.