From: Xeonacid <h.dwwwwww@gmail.com>
Date: Tue, 1 Sep 2026 18:23:56 +0800
Subject: Fix compilation and tests with C++20 (#64)

GCC 16 defaults to C++20, which breaks BRiAl in two places.

std::accumulate now invokes the binary operation as
binary_op(std::move(acc), *i). AddEliminationDegree::operator() took a
non-const size_type& that cannot bind to that rvalue. Take the
accumulator by value and return the updated count instead. The numeric
result is unchanged.

operator==(bool, const BoolePolynomial&) is implemented as
`return (rhs == lhs)`. In C++20 that expression also considers the
reversed candidate, which is this same function, so the comparison
recurses instead of calling BoolePolynomial::operator==(constant_type).
The same issue applies to operator!=. Call the member operators
directly. This keeps the existing semantics and unbreaks tests such as
`true == BoolePolynomial(true, ring)`.
---
 libbrial/include/polybori/BoolePolynomial.h | 4 ++--
 libbrial/src/BoolePolynomial.cc             | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libbrial/include/polybori/BoolePolynomial.h b/libbrial/include/polybori/BoolePolynomial.h
index 2f5f35f8..96a68938 100644
--- a/libbrial/include/polybori/BoolePolynomial.h
+++ b/libbrial/include/polybori/BoolePolynomial.h
@@ -578,14 +578,14 @@ operator%(const BoolePolynomial& lhs, const RHSType& rhs){
 inline BoolePolynomial::bool_type
 operator==(BoolePolynomial::bool_type lhs, const BoolePolynomial& rhs) {
 
-  return (rhs == lhs); 
+  return rhs.operator==(lhs);
 }
 
 /// Nonquality check (with constant lhs)
 inline BoolePolynomial::bool_type
 operator!=(BoolePolynomial::bool_type lhs, const BoolePolynomial& rhs) {
 
-  return (rhs != lhs); 
+  return rhs.operator!=(lhs);
 }
 
 /// Stream output operator
diff --git a/libbrial/src/BoolePolynomial.cc b/libbrial/src/BoolePolynomial.cc
index 8878354a..05e4d844 100644
--- a/libbrial/src/BoolePolynomial.cc
+++ b/libbrial/src/BoolePolynomial.cc
@@ -773,7 +773,7 @@ public:
   AddEliminationDegree(size_type min): 
     m_min(min) {}
 
-  size_type& operator()(size_type& rhs, size_type lhs) {
+  size_type operator()(size_type rhs, size_type lhs) const {
     ++rhs;
     if (lhs > m_min)
       rhs += (lhs - m_min);
