Skip to content

Commit 945509a

Browse files
committed
Work around GCC operator overloading bug in C++20
1 parent 51aea56 commit 945509a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

code/include/rlbox.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,12 +788,20 @@ BinaryOpWrappedRhs(&);
788788
BinaryOpWrappedRhs(|);
789789
BinaryOpWrappedRhs(<<);
790790
BinaryOpWrappedRhs(>>);
791+
792+
// GCC10.1 to GCC13 has a bug where it selects the wrong overload of operator==
793+
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114549 . However C++ 20 also
794+
// provides reverse comparisons by default, and so we no longer need to define
795+
// them. Thus, from C++ 20, we do not define the reverse operators.
796+
#if __cplusplus < 202002L
791797
BinaryOpWrappedRhs(==);
792798
BinaryOpWrappedRhs(!=);
793799
BinaryOpWrappedRhs(<);
794800
BinaryOpWrappedRhs(<=);
795801
BinaryOpWrappedRhs(>);
796802
BinaryOpWrappedRhs(>=);
803+
#endif
804+
797805
#undef BinaryOpWrappedRhs
798806

799807
#define BooleanBinaryOpWrappedRhs(opSymbol) \

0 commit comments

Comments
 (0)