[PATCH] D78938: Fixing all comparisons for C++20 compilation.
Barry Revzin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 06:24:15 PDT 2020
BRevzin added a comment.
In D78938#2007037 <https://reviews.llvm.org/D78938#2007037>, @dblaikie wrote:
> (peanut gallery: I'd consider, while you're touching these all anyway, changing them all to non-member (friended where required) as I believe that's best practice - allows equal implicit conversions on either side, for instance (even if some types have no implicit conversions - it at least provides a nice consistency/examples that people are likely to copy from))
Hidden friend is probably the best way to write comparisons in C++17 and earlier, but I'm not sure that will hold in C++20 (even if LLVM isn't on C++20 and won't be for I imagine quite some time). With reversed candidates, I think member functions might be the way to go there - you still get implicit conversions on either side (just not on both sides at the same time) and hidden friends... are kind of weird, to be honest.
Also, I didn't touch all of them - only the ones that break in C++20 (a lot of which just missing a `const`). A lot of comparison operators are already fine. I'm not sure it's worth changing them just to look the same.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78938/new/
https://reviews.llvm.org/D78938
More information about the cfe-commits
mailing list