Fix GCC 13 warning about ambiguity of operator==() in C++20
In C++20, a==b can also be implicitly rewritten as b==a, assuming commutativity. But if the operator==(const &) is not declared as const, and is thus asymmetric, this results in an ambiguity because neither of a==b or b==a is a better match according to the overload resolution rules.mr#2134
parent
792aa64e76
commit
aeff2bf48d
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2004 Ondra Kamenik
|
||||
* Copyright © 2019 Dynare Team
|
||||
* Copyright © 2019-2023 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
{
|
||||
}
|
||||
bool
|
||||
operator==(const Permutation &p)
|
||||
operator==(const Permutation &p) const
|
||||
{
|
||||
return permap == p.permap;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2004 Ondra Kamenik
|
||||
* Copyright © 2019 Dynare Team
|
||||
* Copyright © 2019-2023 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
per.apply(nvmax);
|
||||
}
|
||||
bool
|
||||
operator==(const PerTensorDimens &td)
|
||||
operator==(const PerTensorDimens &td) const
|
||||
{
|
||||
return TensorDimens::operator==(td) && per == td.per;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue