[libcxx-commits] [PATCH] D96477: [libcxx] adds remaining callable concepts

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 2 12:00:45 PDT 2021


Quuxplusone added a comment.

Line 429/447 still contains a gratuitous whitespace diff.

I suggest fixing that space, then removing the `.subsumption.pass.cpp` tests from this PR, then landing it.
I think it would be reasonable to take the subsumption tests (with my suggested approach above) into a fresh PR.



================
Comment at: libcxx/test/std/concepts/concepts.callable/concept.predicate/predicate.subsumption.pass.cpp:17
+
+[[nodiscard]] constexpr bool check_subsumption(std::regular_invocable auto) {
+  return false;
----------------
I would strongly prefer to see as much of the "cruft" removed from this test as possible, so that we could have a bunch of subsumption tests. The extreme form of that would be to use the `SUBSUMES` macro from https://quuxplusone.github.io/blog/2018/09/23/member-concepts-ii/ . But I think we should actually do more like
https://godbolt.org/z/51edrGrM8
```
bool model(int, int) { return true; }

constexpr bool relation_subsumes_predicate(std::relation auto) requires true { return true; }
constexpr void relation_subsumes_predicate(std::predicate auto) { }
static_assert( relation_subsumes_predicate(model) );
```
in a single `.compile.fail.cpp` file, so that we can verify easily also when a subsumption relationship does //not// exist.

If anyone knows a clever way to detect non-subsumption in a .compile.pass.cpp test, ping me in #meta-programming or something. ;)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96477/new/

https://reviews.llvm.org/D96477



More information about the libcxx-commits mailing list