[PATCH] D134529: [C++20][Clang] P2468R2 The Equality Operator You Are Looking For
Stephan Bergmann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 9 07:30:53 PDT 2022
sberg added a comment.
I just ran into newly-failing
$ cat test.cc
struct S1 {
bool operator==(int);
bool operator!=(int);
};
struct S2;
bool operator ==(S2, S2);
bool f(S1 s) { return 0 == s; }
$ clang++ -std=c++20 -fsyntax-only test.cc
test.cc:7:25: error: invalid operands to binary expression ('int' and 'S1')
bool f(S1 s) { return 0 == s; }
~ ^ ~
test.cc:6:6: note: candidate function not viable: no known conversion from 'int' to 'S2' for 1st argument
bool operator ==(S2, S2);
^
1 error generated.
It looks to me like this is correctly rejected now per P2468R2. But it is rather confusing that a note mentions the `S2` candidate, while the relevant `S1` operators `==` and `!=` are not mentioned at all.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134529/new/
https://reviews.llvm.org/D134529
More information about the cfe-commits
mailing list