You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[MSVC][std:c++latest] Z3 build failed due to error C2666: 'lp::stacked_vector<lp::numeric_pair<lp::mpq>>::ref::operator ==': overloaded functions have similar conversions
#6481
Closed
fangzhouxia opened this issue
Dec 7, 2022
· 4 comments
Is godbolt's MSVC up-to-date? Can you help me repro the issue?
The code feels similar to this: https://gcc.godbolt.org/z/4jxv486f1
But it compiles just fine.
We are using internal the latest version of the compiler for testing. Therefore, neither the latest release VS and Godbolt cannot reproduce it.
Use our internal version compile the code in https://gcc.godbolt.org/z/4jxv486f1 with /std:c++latest, which also reports the error C2666. I try to add bool operator!=(const A&a) const; the error can indeed be solved.
I'm sorry, but I don't understand the problem. It seems MSVC/the ISO committee wants to break all code out there..
Is the issue that there's an automatic cast operator declared?
Description:
After the MSVC team implented P2468R2 The Equality Operator You Are Looking For, we got a compiler error with /std:c++latest like below, the error is due to the operator== https://github.com/Z3Prover/z3/blob/master/src/math/lp/stacked_vector.h#L55. In order to fix this the 'ref' log_entry::ref class needs a corresponding 'operator!=' like so, could you please look this issue? Thanks.
Note: this issue will be reproduced on next release version of VS(17.6 or later).
Reproduction steps:
Expected behavio:r
Build successfully.
Actual behavior:
build.log
F:\gitP\Z3Prover\z3\src\math\lp\lar_solver.cpp(2161): error C2666: 'lp::stacked_vector<lp::numeric_pairlp::mpq>::ref::operator ==': overloaded functions have similar conversions
F:\gitP\Z3Prover\z3\src\math/lp/stacked_vector.h(55): note: could be 'bool lp::stacked_vector<lp::numeric_pairlp::mpq>::ref::operator ==(const B &) const'
with
[
B=lp::numeric_pairlp::mpq
]
F:\gitP\Z3Prover\z3\src\util/mpbq.h(331): note: or 'bool operator ==(const scoped_mpbq &,const mpz &)'
F:\gitP\Z3Prover\z3\src\util/mpbq.h(331): note: or 'bool operator ==(const scoped_mpbq &,const int &)'
F:\gitP\Z3Prover\z3\src\util/rational.h(550): note: or 'bool operator ==(const rational &,int)'
F:\gitP\Z3Prover\z3\src\math/lp/stacked_vector.h(55): note: or 'bool lp::stacked_vector<lp::numeric_pairlp::mpq>::ref::operator ==(const B &) const' [synthesized expression 'y == x']
with
[
B=lp::numeric_pairlp::mpq
]
F:\gitP\Z3Prover\z3\src\util/rational.h(550): note: or 'bool operator ==(const rational &,int)' [synthesized expression 'y == x']
F:\gitP\Z3Prover\z3\src\util/mpbq.h(331): note: or 'bool operator ==(const scoped_mpbq &,const int &)' [synthesized expression 'y == x']
F:\gitP\Z3Prover\z3\src\util/mpbq.h(331): note: or 'bool operator ==(const scoped_mpbq &,const mpz &)' [synthesized expression 'y == x']
F:\gitP\Z3Prover\z3\src\util/obj_ref.h(128): note: or 'bool operator ==(const obj_ref<T1,TManager> &,const obj_ref<T2,TManager> &)'
src\math\lp\lar_solver.cpp(2161): note: 'bool operator ==(const obj_ref<T1,TManager> &,const obj_ref<T2,TManager> &)': could not deduce template argument for 'const obj_ref<T1,TManager> &' from 'lp::stacked_vector<lp::numeric_pairlp::mpq>::ref'
F:\gitP\Z3Prover\z3\src\util/obj_ref.h(123): note: or 'bool operator ==(const obj_ref<T,TManager> &,const obj_ref<T,TManager> &)'
src\math\lp\lar_solver.cpp(2161): note: 'bool operator ==(const obj_ref<T,TManager> &,const obj_ref<T,TManager> &)': could not deduce template argument for 'const obj_ref<T,TManager> &' from 'lp::stacked_vector<lp::numeric_pairlp::mpq>::ref'
F:\gitP\Z3Prover\z3\src\util/obj_ref.h(123): note: or 'bool operator ==(const obj_ref<T,TManager> &,const obj_ref<T,TManager> &)' [synthesized expression 'y == x']
src\math\lp\lar_solver.cpp(2161): note: 'bool operator ==(const obj_ref<T,TManager> &,const obj_ref<T,TManager> &)': could not deduce template argument for 'const obj_ref<T,TManager> &' from 'lp::stacked_vector<lp::numeric_pairlp::mpq>::ref'
F:\gitP\Z3Prover\z3\src\util/obj_ref.h(128): note: or 'bool operator ==(const obj_ref<T1,TManager> &,const obj_ref<T2,TManager> &)' [synthesized expression 'y == x']
src\math\lp\lar_solver.cpp(2161): note: 'bool operator ==(const obj_ref<T1,TManager> &,const obj_ref<T2,TManager> &)': could not deduce template argument for 'const obj_ref<T1,TManager> &' from 'lp::stacked_vector<lp::numeric_pairlp::mpq>::ref'
src\math\lp\lar_solver.cpp(2161): note: while trying to match the argument list '(lp::stacked_vector<lp::numeric_pairlp::mpq>::ref, lp::stacked_vector<lp::numeric_pairlp::mpq>::ref)'
The text was updated successfully, but these errors were encountered: