https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92847 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Laurent Stacul from comment #0) > bool operator==(const A<T>&) { return true; } This member function should be const.