[libcxx-commits] [PATCH] D97176: [libcxx] adds concepts std::equality_comparable[_with]
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 3 18:03:42 PST 2021
Quuxplusone added inline comments.
================
Comment at: libcxx/test/std/concepts/comparison/types.h:85
+
+struct no_neq {
+ friend bool operator==(no_neq, no_neq) noexcept;
----------------
cjdb wrote:
> Quuxplusone wrote:
> > I'd say `deleted_ne`. This case is (intentionally) non-parallel to the `no_eq` case above.
> I intended them to mirror one another, so I'm not sure I understand what you're getting at.
`no_neq` has both an `operator==` and an `operator!=`, so when you try to do `x != x` you get the user-provided `operator!=` — which happens to be deleted, so `x != x` is ill-formed.
`no_eq` has an `operator!=` and no `operator==`, so when you try to do `x == x`... well, okay, I had thought that you'd get a synthesized candidate (if I'm using that term right) formed by negating `x != x`. I see from Godbolt that that doesn't actually happen. So indeed, `x == x` also ends up ill-formed.
IOW I was assuming that [this asymmetry](https://godbolt.org/z/71Kfae) would materially affect your test results... but it seems that it doesn't really affect them as much as I thought. So nvm.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97176/new/
https://reviews.llvm.org/D97176
More information about the libcxx-commits
mailing list