spaceship.patch raw
1 commit e3da7da967b94f373c29a198ce45f30fb9f0e517
2 Author: Ed Catmur <ed@catmur.uk>
3 Date: Tue Jan 31 16:27:04 2023 +0000
4
5 Remove operator!= synthesized by spaceship
6
7 An operator!= suppresses the reversed equality comparison candidate generation.
8
9 This is visible in clang 16 (rc0 just released) and in gcc trunk (so probably gcc 13).
10
11 diff --git a/c++/src/kj/string.h b/c++/src/kj/string.h
12 index 193442aa..17835892 100644
13 --- a/c++/src/kj/string.h
14 +++ b/c++/src/kj/string.h
15 @@ -122,10 +122,14 @@ public:
16 inline constexpr const char* end() const { return content.end() - 1; }
17
18 inline constexpr bool operator==(decltype(nullptr)) const { return content.size() <= 1; }
19 +#if !__cpp_impl_three_way_comparison
20 inline constexpr bool operator!=(decltype(nullptr)) const { return content.size() > 1; }
21 +#endif
22
23 inline bool operator==(const StringPtr& other) const;
24 +#if !__cpp_impl_three_way_comparison
25 inline bool operator!=(const StringPtr& other) const { return !(*this == other); }
26 +#endif
27 inline bool operator< (const StringPtr& other) const;
28 inline bool operator> (const StringPtr& other) const { return other < *this; }
29 inline bool operator<=(const StringPtr& other) const { return !(other < *this); }
30