This is an archive of the discontinued LLVM Phabricator instance.

[libc++] [test] Improve the tests for std::assignable_from
ClosedPublic

Authored by Quuxplusone on Jan 16 2022, 9:39 AM.

Details

Summary

Fixes https://github.com/llvm/llvm-project/issues/50060 .
Looking into this file gave me a wtf moment. So I rewrote this whole test so that it actually tests the stuff we're trying to test. For each subexpression of the concept, test what happens when it fails. Also, test some types that mimic weird standard types, such as std::locale (returns by const reference) and std::tuple-of-references.

Diff Detail

Event Timeline

Quuxplusone requested review of this revision.Jan 16 2022, 9:39 AM
Quuxplusone created this revision.
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald TranscriptJan 16 2022, 9:39 AM
ldionne accepted this revision.Jan 17 2022, 8:25 AM

LGTM with nitpick comment.

libcxx/test/std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp
12–20

We've never done it that way, and I don't think we should start now.

442

Some of the complexity in this test comes from the fact that we're doing conformance testing for several standard types, which is something I had required when we first started working on concepts. In retrospect, I think the complexity/value tradeoff of these tests is not as high as I thought.

This revision is now accepted and ready to land.Jan 17 2022, 8:25 AM
Quuxplusone marked an inline comment as done.Jan 17 2022, 9:11 AM