Skip to content

Commit afaa48d

Browse files
sample fix script
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent fa1a2cd commit afaa48d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

genaisrc/FixBuildIssue.genai.mjs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
def("FILE", env.files)
3+
4+
def("ERR", "/home/nbjorner/z3/src/nlsat/nlsat_simple_checker.cpp: In member function ‘bool nlsat::simple_checker::imp::Endpoint::operator==(const nlsat::simple_checker::imp::Endpoint&) const’:\
5+
/home/nbjorner/z3/src/nlsat/nlsat_simple_checker.cpp:63:82: warning: C++20 says that these are ambiguous, even though the second is reversed:\
6+
63 | if (!m_inf && !rhs.m_inf && m_open == rhs.m_open && m_val == rhs.m_val) {\
7+
| ^~~~~\
8+
In file included from /home/nbjorner/z3/src/util/mpz.h:26,\
9+
from /home/nbjorner/z3/src/util/mpq.h:21,\
10+
from /home/nbjorner/z3/src/util/rational.h:21,\
11+
from /home/nbjorner/z3/src/math/polynomial/algebraic_numbers.h:21,\
12+
from /home/nbjorner/z3/src/nlsat/nlsat_simple_checker.h:20,\
13+
from /home/nbjorner/z3/src/nlsat/nlsat_simple_checker.cpp:1:\
14+
/home/nbjorner/z3/src/util/scoped_numeral.h:96:17: note: candidate 1: ‘bool operator==(const _scoped_numeral<algebraic_numbers::manager>&, const _scoped_numeral<algebraic_numbers::manager>::numeral&)’\
15+
96 | friend bool operator==(_scoped_numeral const & a, numeral const & b) {\
16+
| ^~~~~~~~\
17+
/home/nbjorner/z3/src/util/scoped_numeral.h:96:17: note: candidate 2: ‘bool operator==(const _scoped_numeral<algebraic_numbers::manager>&, const _scoped_numeral<algebraic_numbers::manager>::numeral&)’ (reversed)")
18+
19+
$`You are an expert C++ programmer.
20+
Your task is to fix the compilation bug reported in the error message ERR.
21+
How should FILE be changed to fix the error message?`

src/util/scoped_numeral.h

+9
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,19 @@ class _scoped_numeral {
9797
return a.m().eq(a, b);
9898
}
9999

100+
friend bool operator==(_scoped_numeral const & a, _scoped_numeral const & b) {
101+
return a.m().eq(a.m_num, b.m_num);
102+
}
103+
100104
friend bool operator!=(_scoped_numeral const & a, numeral const & b) {
101105
return !a.m().eq(a, b);
102106
}
103107

108+
friend bool operator!=(_scoped_numeral const & a, _scoped_numeral const & b) {
109+
return !(a == b);
110+
}
111+
112+
104113
friend bool operator<(_scoped_numeral const & a, numeral const & b) {
105114
return a.m().lt(a, b);
106115
}

0 commit comments

Comments
 (0)