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

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 1 16:49:58 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/test/std/concepts/concepts.callable/concepts.strictweakorder/strict_weak_order.pass.cpp:29
+struct S1 {};
+static_assert(!std::strict_weak_order<int S1::*, S1*, std::nullptr_t>);
+
----------------
FWIW, I have no idea what this assertion is testing. It's asking whether you can use a pointer-to-data-member as a callable, passing it an `S1*` and `nullptr`, and get back a boolean answer? Isn't the answer obviously "no"?

Vice versa, it occurs to me that
```
static_assert(std::relation<bool (S::*)(S*), S*, S*>);
static_assert(std::relation<bool (S::*)(S&), S&, S&>);
```
might be considered non-obvious.


================
Comment at: libcxx/test/std/concepts/concepts.callable/concepts.strictweakorder/strict_weak_order.subsumption.pass.cpp:18-24
+template<class F, class T, class U>
+requires std::relation<F&, T, U>
+[[nodiscard]] constexpr bool check_subsumption() { return false; }
+
+template<class F, class T, class U>
+requires std::strict_weak_order<F&, T, U> && true
+[[nodiscard]] constexpr bool check_subsumption() { return true; }
----------------
Two instances of `F&` that could be `F`, here.
(Also, I'd prefer to see you remove the gratuituous clang-format comments; they don't add anything.)


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