]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: Add missing 'const' to equiv_class::operator==
authorJonathan Wakely <jwakely@redhat.com>
Thu, 27 Nov 2025 16:13:44 +0000 (16:13 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 27 Nov 2025 16:32:57 +0000 (16:32 +0000)
commitdfd17e05f9e983660b87e603c062918d2d173fc3
tree3931fdf91e9988fc7a658db5e32275be6437bac1
parent7f355b11db1c83158a8f7d8c323c4920bee21ce8
analyzer: Add missing 'const' to equiv_class::operator==

This produces a warning in C++20:

/home/test/src/gcc/gcc/analyzer/constraint-manager.cc: In member function ‘bool ana::constraint_manager::operator==(const ana::constraint_manager&) const’:
/home/test/src/gcc/gcc/analyzer/constraint-manager.cc:1610:42: warning: C++20 says that these are ambiguous, even though the second is reversed:
 1610 |     if (!(*ec == *other.m_equiv_classes[i]))
      |                                          ^
/home/test/src/gcc/gcc/analyzer/constraint-manager.cc:1178:1: note: candidate 1: ‘bool ana::equiv_class::operator==(const ana::equiv_class&)’
 1178 | equiv_class::operator== (const equiv_class &other)
      | ^~~~~~~~~~~
/home/test/src/gcc/gcc/analyzer/constraint-manager.cc:1178:1: note: candidate 2: ‘bool ana::equiv_class::operator==(const ana::equiv_class&)’ (reversed)
/home/test/src/gcc/gcc/analyzer/constraint-manager.cc:1178:1: note: try making the operator a ‘const’ member function

gcc/analyzer/ChangeLog:

* constraint-manager.cc (equiv_class::operator==): Add const
qualifier.
* constraint-manager.h (equiv_class::operator==): Likewise.
gcc/analyzer/constraint-manager.cc
gcc/analyzer/constraint-manager.h