https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92847
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Reduced: template<typename T> struct A { A() {} template<typename U> A(const A<U>&) {} bool operator==(const A&) const { return true; } }; A<const int> a; A<int> b; auto c = (a == b); Compiled with -std=gnu++2a: cmp.cc:13:13: error: ambiguous overload for 'operator==' (operand types are 'A<const int>' and 'A<int>') 13 | auto c = (a == b); | ~ ^~ ~ | | | | | A<int> | A<const int> cmp.cc:8:8: note: candidate: 'bool A<T>::operator==(const A<T>&) const [with T = int]' (reversed) 8 | bool operator==(const A&) const { return true; } | ^~~~~~~~ cmp.cc:8:8: note: candidate: 'bool A<T>::operator==(const A<T>&) const [with T = const int]'